BEST NAME PROTECT | OPEN SRC  | FOR VIDEO
Key RequiredUniversal

BEST NAME PROTECT | OPEN SRC | FOR VIDEO

Universal Scriptbettusanbettusan 1.5K views 129 executesUpdated Jan 16, 2026
5.0/ 5(3 votes)
30100% Positive
Lua Script•83 lines (2766 chars)
local CONFIG = {
    FakeName = "PROTECTED",      -- What to replace the username with
    FakeDisplay = "PROTECTED",   -- What to replace the DisplayName with
    MatchColor = true            -- Try to preserve formatting (useful for chat)
}

local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local RunService = game:GetService("RunService")

-- Cache real names to avoid fetching them constantly
local RealName = LocalPlayer.Name
local RealDisplay = LocalPlayer.DisplayName

-- Function that instantly replaces text
local function SpoofText(obj)
    -- Check if the text actually contains the name to reduce load
    if not obj.Text:find(RealName) and not obj.Text:find(RealDisplay) then return end

    -- Temporarily disable the listener to avoid recursion (infinite loop)
    local originalText = obj.Text
    
    local newText = originalText:gsub(RealName, CONFIG.FakeName)
    newText = newText:gsub(RealDisplay, CONFIG.FakeDisplay)
    
    if originalText ~= newText then
        obj.Text = newText
    end
end

-- Function to process an object (attach "eyes" to it)
local function MonitorObject(obj)
    -- Work only with text elements
    if obj:IsA("TextLabel") or obj:IsA("TextButton") or obj:IsA("TextBox") then
        
        -- 1. Replace text immediately
        SpoofText(obj)

        -- 2. Attach an event: if the game tries to change the text back, replace it again
        obj:GetPropertyChangedSignal("Text"):Connect(function()
            SpoofText(obj)
        end)
    end
end

-- === START ===

-- 1. Scan existing UI (PlayerGui)
for _, v in ipairs(LocalPlayer.PlayerGui:GetDescendants()) do
    MonitorObject(v)
end

-- 2. Listen for NEW elements added to PlayerGui (to avoid rescanning everything)
LocalPlayer.PlayerGui.DescendantAdded:Connect(MonitorObject)

-- 3. Handle CoreGui (Leaderboard, Esc menu, Chat) - Requires executor
pcall(function()
    local CoreGui = game:GetService("CoreGui")
    for _, v in ipairs(CoreGui:GetDescendants()) do
        MonitorObject(v)
    end
    CoreGui.DescendantAdded:Connect(MonitorObject)
end)

-- 4. Handle character (Name above the head)
local function MonitorCharacter(char)
    local humanoid = char:WaitForChild("Humanoid", 10)
    if humanoid then
        humanoid.DisplayName = CONFIG.FakeDisplay
        -- If the game updates the Humanoid (e.g. on respawn), keep tracking changes
        humanoid:GetPropertyChangedSignal("DisplayName"):Connect(function()
            if humanoid.DisplayName ~= CONFIG.FakeDisplay then
                humanoid.DisplayName = CONFIG.FakeDisplay
            end
        end)
    end
end

if LocalPlayer.Character then
    MonitorCharacter(LocalPlayer.Character)
end

LocalPlayer.CharacterAdded:Connect(MonitorCharacter)

Features & Information

A Name Protect script hides the local player’s real username on the screen by replacing it with a fake name for example, to create a video. It works client-side only, changing UI text like name tags or labels. The server and other players still see the real username. ChatGPT solution
#name#protect#fake name#fake#video

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts