Back to Scripts
Open Source ClientSide Player Namespoof And Avatar Changer

Open Source ClientSide Player Namespoof And Avatar Changer

ScriptBlox
Universal Free

Game: Universal Script 📌

127 Views
0 Likes
0 Dislikes
Lamiia

Lamiia

offline

Features

Doesn't change chat color/r15 charactor (Because I don't know how)

Script Code

local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local CoreGui = game:GetService("CoreGui")
local TextChatService = game:GetService("TextChatService")

local lp = Players.LocalPlayer

-- Store active connections for cleanup
local activeConnections = {}

if not getgenv().Config then
    getgenv().Config = {
        FakeDisplayName = "Roblox",
        FakeName = "Roblox", 
        FakeId = 1,
        TargetPlayer = "", 
        IsActive = false
    }
end

getgenv().OriginalValues = {
    Name = lp.Name,
    DisplayName = lp.DisplayName,
    UserId = lp.UserId
}

-- Store original character appearance
getgenv().OriginalCharacterAppearanceId = lp.CharacterAppearanceId


local function getTargetOriginalValues(targetName)
    if targetName == "" or targetName == lp.Name then
        return getgenv().OriginalValues
    else
        local targetPlayer = Players:FindFirstChild(targetName)
        if targetPlayer then
            return {
                Name = targetPlayer.Name,
                DisplayName = targetPlayer.DisplayName,
                UserId = targetPlayer.UserId
            }
        end
    end
    return getgenv().OriginalValues
end

-- Cleanup function to disconnect all active connections
local function cleanup()
    for _, connection in pairs(activeConnections) do
        if typeof(connection) == "RBXScriptConnection" then
            connection:Disconnect()
        end
    end
    activeConnections = {}
end

-- Function to get profile picture URL using Roblox API
local function getProfilePictureUrl(userId)
    local thumbType = Enum.ThumbnailType.HeadShot
    local thumbSize = Enum.ThumbnailSize.Size420x420
    local content, isReady = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)
    return content
end

-- Function to disguise character
local function disguisechar(char, id)
    task.spawn(function()
        print('Disguising character...')
        if not char then
            return
        end
        
        -- Wait for humanoid and head
        local hum = char:WaitForChild("Humanoid")
        char:WaitForChild("Head")
        
        local desc
        repeat
            local suc = pcall(function()
                desc = Players:GetHumanoidDescriptionFromUserId(id)
            end)
            if not suc then
                task.wait(1)
            end
        until desc ~= nil
        
        -- Get original height scale
        local originalDesc = hum:FindFirstChild("HumanoidDescription")
        if originalDesc then
            desc.HeightScale = originalDesc.HeightScale
        end
        
        char.Archivable = true
        local disguiseclone = char:Clone()
        disguiseclone.Name = "disguisechar"
        disguiseclone.Parent = workspace
        
        -- Remove existing accessories and clothing from clone
        for i, v in pairs(disguiseclone:GetChildren()) do
            if v:IsA("Accessory") or v:IsA("ShirtGraphic") or v:IsA("Shirt") or v:IsA("Pants") then
                v:Destroy()
            end
        end
        
        -- Apply new description to clone
        disguiseclone.Humanoid:ApplyDescriptionClientServer(desc)
        
        -- Remove existing accessories and clothing from real character
        for i, v in pairs(char:GetChildren()) do
            if (v:IsA("Accessory") and v:GetAttribute("InvItem") == nil and v:GetAttribute("ArmorSlot") == nil) or 
               v:IsA("ShirtGraphic") or v:IsA("Shirt") or v:IsA("Pants") or v:IsA("BodyColors") then
                v:Destroy()
            end
        end
        
        -- Prevent new items from being added
        local childAddedConnection
        childAddedConnection = char.ChildAdded:Connect(function(v)
            if ((v:IsA("Accessory") and v:GetAttribute("InvItem") == nil and v:GetAttribute("ArmorSlot") == nil) or 
                v:IsA("ShirtGraphic") or v:IsA("Shirt") or v:IsA("Pants") or v:IsA("BodyColors")) and 
                v:GetAttribute("Disguise") == nil then
                v:Destroy()
            end
        end)
        table.insert(activeConnections, childAddedConnection)
        
        -- Transfer animations
        if disguiseclone:FindFirstChild("Animate") and char:FindFirstChild("Animate") then
            for i, v in pairs(disguiseclone.Animate:GetChildren()) do
                v:SetAttribute("Disguise", true)
                local real = char.Animate:FindFirstChild(v.Name)
                if v:IsA("StringValue") and real then
                    real:Destroy()
                    v:Clone().Parent = char.Animate
                end
            end
        end
        
        -- Transfer accessories and clothing
        for i, v in pairs(disguiseclone:GetChildren()) do
            if v:IsA("Accessory") then
                local accessoryClone = v:Clone()
                accessoryClone:SetAttribute("Disguise", true)
                
                -- Fix welds
                for i2, v2 in pairs(accessoryClone:GetDescendants()) do
                    if v2:IsA("Weld") and v2.Part1 then
                        local partName = v2.Part1.Name
                        if char:FindFirstChild(partName) then
                            v2.Part1 = char[partName]
                        end
                    end
                end
                accessoryClone.Parent = char
                
            elseif v:IsA("ShirtGraphic") or v:IsA("Shirt") or v:IsA("Pants") or v:IsA("BodyColors") then
                local itemClone = v:Clone()
                itemClone:SetAttribute("Disguise", true)
                itemClone.Parent = char
                
            elseif v.Name == "Head" and v:FindFirstChildOfClass('SpecialMesh') then
                local headMesh = v:FindFirstChildOfClass('SpecialMesh')
                if char.Head:FindFirstChildOfClass('SpecialMesh') then
                    char.Head:FindFirstChildOfClass('SpecialMesh').MeshId = headMesh.MeshId
                end
            end
        end
        
        -- Transfer face
        local localface = char:FindFirstChild("face", true)
        local cloneface = disguiseclone:FindFirstChild("face", true)
        if localface then
            localface:Destroy()
        end
        if cloneface then
            local faceClone = cloneface:Clone()
            faceClone.Parent = char.Head
        end
        
        -- Transfer emotes
        if hum.HumanoidDescription then
            hum.HumanoidDescription:SetEmotes(desc:GetEmotes())
            hum.HumanoidDescription:SetEquippedEmotes(desc:GetEquippedEmotes())
        end
        
        -- Cleanup
        disguiseclone:Destroy()
        print('Character disguise applied successfully!')
    end)
end

-- Function to setup character disguise
local function setupCharacterDisguise()
    if not Config.IsActive then return end
    
    local targetPlayer = Config.TargetPlayer == "" and lp or Players:FindFirstChild(Config.TargetPlayer)
    if not targetPlayer then
        warn("Target player not found: " .. Config.TargetPlayer)
        return
    end
    
    -- Apply disguise to current character
    if targetPlayer.Character then
        disguisechar(targetPlayer.Character, Config.FakeId)
    end
    
    -- Connect to character added event
    local charConnection = targetPlayer.CharacterAdded:Connect(function(char)
        disguisechar(char, Config.FakeId)
    end)
    table.insert(activeConnections, charConnection)
end

-- Function to process text replacement
local function processtext(text)
    local targetOriginalValues = getTargetOriginalValues(Config.TargetPlayer)
    
    if string.gsub(text, targetOriginalValues.Name, Config.FakeName) ~= text then
        return string.gsub(text, targetOriginalValues.Name, Config.FakeName)
    elseif string.gsub(text, tostring(targetOriginalValues.UserId), tostring(Config.FakeId)) ~= text then
        return string.gsub(text, tostring(targetOriginalValues.UserId), tostring(Config.FakeId))
    elseif string.gsub(text, targetOriginalValues.DisplayName, Config.FakeDisplayName) ~= text then
        return string.gsub(text, targetOriginalValues.DisplayName, Config.FakeDisplayName)
    end
    if text ~= nil then
        return text
    end
    return ''
end

-- Function to replace text in GUI objects
local function replaceTextInObject(obj)
    if not Config.IsActive then return end
    
    if obj:IsA("TextLabel") or obj:IsA("TextButton") or obj:IsA("TextBox") then
        -- Prevent duplicate processing
        if obj:GetAttribute("TextReplaced") then return end
        obj:SetAttribute("TextReplaced", true)
        
        obj.Text = processtext(obj.Text)
        obj.Name = processtext(obj.Name)
        
        local textConnection = obj:GetPropertyChangedSignal("Text"):Connect(function()
            if not Config.IsActive then return end
            obj.Text = processtext(obj.Text)
        end)
        
        local nameConnection = obj:GetPropertyChangedSignal("Name"):Connect(function()
            if not Config.IsActive then return end
            obj.Name = processtext(obj.Name)
        end)
        
        table.insert(activeConnections, textConnection)
        table.insert(activeConnections, nameConnection)
    end
end

-- Function to replace images in GUI objects
local function replaceImageInObject(obj)
    if not Config.IsActive then return end
    
    if obj:IsA("ImageLabel") or obj:IsA("ImageButton") then
        -- Prevent duplicate processing
        if obj:GetAttribute("ImageReplaced") then return end
        obj:SetAttribute("ImageReplaced", true)
        
        local targetOriginalValues = getTargetOriginalValues(Config.TargetPlayer)
        local image = obj.Image
        
        if string.find(image, tostring(targetOriginalValues.UserId)) then
            obj.Image = getProfilePictureUrl(Config.FakeId)
        elseif string.find(image, targetOriginalValues.Name) then
            obj.Image = getProfilePictureUrl(Config.FakeId)
        end
        
        local imageConnection = obj:GetPropertyChangedSignal("Image"):Connect(function()
            if not Config.IsActive then return end
            task.wait()
            local newImage = obj.Image
            if string.find(newImage, tostring(targetOriginalValues.UserId)) then
                obj.Image = getProfilePictureUrl(Config.FakeId)
            elseif string.find(newImage, targetOriginalValues.Name) then
                obj.Image = getProfilePictureUrl(Config.FakeId)
            end
        end)
        table.insert(activeConnections, imageConnection)
    end
end

-- Function to setup global text/image replacement hooks
local function setupGlobalHook()
    if not Config.IsActive then return end
    
    -- Clear existing text/image attributes to allow reprocessing
    for _, obj in pairs(game:GetDescendants()) do
        if obj:GetAttribute("TextReplaced") then
            obj:SetAttribute("TextReplaced", nil)
        end
        if obj:GetAttribute("ImageReplaced") then
            obj:SetAttribute("ImageReplaced", nil)
        end
        replaceTextInObject(obj)
        replaceImageInObject(obj)
    end
    
    -- Store game descendant connection
    local gameConnection = game.DescendantAdded:Connect(function(obj)
        replaceTextInObject(obj)
        replaceImageInObject(obj)
    end)
    table.insert(activeConnections, gameConnection)
end

-- Function to hook player list GUI
local function hookPlayerList()
    if not Config.IsActive then return end
    
    local function processPlayerList()
        local playerList = CoreGui:FindFirstChild("PlayerList")
        if playerList then
            -- Clear existing attributes
            for _, obj in ipairs(playerList:GetDescendants()) do
                if obj:GetAttribute("TextReplaced") then
                    obj:SetAttribute("TextReplaced", nil)
                end
                if obj:GetAttribute("ImageReplaced") then
                    obj:SetAttribute("ImageReplaced", nil)
                end
                replaceTextInObject(obj)
                replaceImageInObject(obj)
            end
            
            -- Store player list connection
            local playerListConnection = playerList.DescendantAdded:Connect(function(obj)
                replaceTextInObject(obj)
                replaceImageInObject(obj)
            end)
            table.insert(activeConnections, playerListConnection)
        end
    end

    processPlayerList()
end

-- Function to hook CoreGui
local function hookCoreGui()
    if not Config.IsActive then return end
    
    -- Clear existing attributes
    for _, obj in pairs(CoreGui:GetDescendants()) do
        if obj:GetAttribute("TextReplaced") then
            obj:SetAttribute("TextReplaced", nil)
        end
        if obj:GetAttribute("ImageReplaced") then
            obj:SetAttribute("ImageReplaced", nil)
        end
        replaceTextInObject(obj)
        replaceImageInObject(obj)
    end
    
    -- Store CoreGui connection
    local coreGuiConnection = CoreGui.DescendantAdded:Connect(function(obj)
        replaceTextInObject(obj)
        replaceImageInObject(obj)
    end)
    table.insert(activeConnections, coreGuiConnection)
end

-- Function to activate spoofing
local function activateSpoofing()
    Config.IsActive = true
    
    -- Apply display name and character appearance ID only if targeting self
    if Config.TargetPlayer == "" then
        lp.DisplayName = Config.FakeDisplayName
        lp.CharacterAppearanceId = Config.FakeId
    end
    
    -- Start all hooks
    setupGlobalHook()
    hookPlayerList()
    hookCoreGui()
    
    -- Setup character disguise
    setupCharacterDisguise()
end

-- Function to completely deactivate spoofing and restore everything
local function deactivateSpoofing()
    Config.IsActive = false
    
    -- Disconnect all connections
    cleanup()
    
    -- Restore original values only if targeting self
    if Config.TargetPlayer == "" then
        lp.DisplayName = getgenv().OriginalValues.DisplayName
        lp.CharacterAppearanceId = getgenv().OriginalCharacterAppearanceId
    end
    
    -- Clear all attributes for reprocessing
    for _, obj in pairs(game:GetDescendants()) do
        if obj:GetAttribute("TextReplaced") then
            obj:SetAttribute("TextReplaced", nil)
        end
        if obj:GetAttribute("ImageReplaced") then
            obj:SetAttribute("ImageReplaced", nil)
        end
    end
    for _, obj in pairs(CoreGui:GetDescendants()) do
        if obj:GetAttribute("TextReplaced") then
            obj:SetAttribute("TextReplaced", nil)
        end
        if obj:GetAttribute("ImageReplaced") then
            obj:SetAttribute("ImageReplaced", nil)
        end
    end
end

-- Function to completely shutdown the spoofer
local function shutdownSpoofer()
    deactivateSpoofing()
    
    -- Remove the UI
    if getgenv().SpooferUI then
        getgenv().SpooferUI:Destroy()
        getgenv().SpooferUI = nil
    else

        local spooferUI = CoreGui:FindFirstChild("NameSpoofUI")
        if spooferUI then
            spooferUI:Destroy()
        end
    end
    
    -- Clear global variables
    getgenv().Config = nil
    getgenv().OriginalValues = nil
    getgenv().OriginalCharacterAppearanceId = nil
end

-- Create modern UI
local function createModernUI()
    local ScreenGui = Instance.new("ScreenGui")
    ScreenGui.Name = "NameSpoofUI"
    ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
    ScreenGui.Parent = CoreGui


    getgenv().SpooferUI = ScreenGui

    local MainFrame = Instance.new("Frame")
    MainFrame.Name = "MainFrame"
    MainFrame.Size = UDim2.new(0, 350, 0, 450)
    MainFrame.Position = UDim2.new(0.5, -175, 0.5, -175)
    MainFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 40)
    MainFrame.BorderSizePixel = 0
    MainFrame.ClipsDescendants = true
    MainFrame.Parent = ScreenGui

    local UICorner = Instance.new("UICorner")
    UICorner.CornerRadius = UDim.new(0, 12)
    UICorner.Parent = MainFrame

    local TitleBar = Instance.new("Frame")
    TitleBar.Name = "TitleBar"
    TitleBar.Size = UDim2.new(1, 0, 0, 40)
    TitleBar.BackgroundColor3 = Color3.fromRGB(45, 45, 55)
    TitleBar.BorderSizePixel = 0
    TitleBar.Parent = MainFrame

    local TitleCorner = Instance.new("UICorner")
    TitleCorner.CornerRadius = UDim.new(0, 12)
    TitleCorner.Parent = TitleBar

    local TitleLabel = Instance.new("TextLabel")
    TitleLabel.Name = "TitleLabel"
    TitleLabel.Size = UDim2.new(1, -40, 1, 0)
    TitleLabel.Position = UDim2.new(0, 20, 0, 0)
    TitleLabel.BackgroundTransparency = 1
    TitleLabel.Text = "Name Spoofer"
    TitleLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
    TitleLabel.TextSize = 18
    TitleLabel.Font = Enum.Font.GothamBold
    TitleLabel.TextXAlignment = Enum.TextXAlignment.Left
    TitleLabel.Parent = TitleBar

    local CloseButton = Instance.new("TextButton")
    CloseButton.Name = "CloseButton"
    CloseButton.Size = UDim2.new(0, 30, 0, 30)
    CloseButton.Position = UDim2.new(1, -35, 0, 5)
    CloseButton.BackgroundColor3 = Color3.fromRGB(255, 60, 60)
    CloseButton.BorderSizePixel = 0
    CloseButton.Text = "×"
    CloseButton.TextColor3 = Color3.fromRGB(255, 255, 255)
    CloseButton.TextSize = 20
    CloseButton.Font = Enum.Font.GothamBold
    CloseButton.Parent = TitleBar

    local CloseCorner = Instance.new("UICorner")
    CloseCorner.CornerRadius = UDim.new(0, 6)
    CloseCorner.Parent = CloseButton

    local ContentFrame = Instance.new("Frame")
    ContentFrame.Name = "ContentFrame"
    ContentFrame.Size = UDim2.new(1, -40, 1, -100)
    ContentFrame.Position = UDim2.new(0, 20, 0, 50)
    ContentFrame.BackgroundTransparency = 1
    ContentFrame.Parent = MainFrame

    local function createInputField(name, placeholder, defaultValue, yPosition)
        local Container = Instance.new("Frame")
        Container.Name = name .. "Container"
        Container.Size = UDim2.new(1, 0, 0, 70)
        Container.Position = UDim2.new(0, 0, 0, yPosition)
        Container.BackgroundTransparency = 1
        Container.Parent = ContentFrame

        local Label = Instance.new("TextLabel")
        Label.Name = name .. "Label"
        Label.Size = UDim2.new(1, 0, 0, 20)
        Label.BackgroundTransparency = 1
        Label.Text = placeholder
        Label.TextColor3 = Color3.fromRGB(200, 200, 200)
        Label.TextSize = 14
        Label.Font = Enum.Font.Gotham
        Label.TextXAlignment = Enum.TextXAlignment.Left
        Label.Parent = Container

        local TextBox = Instance.new("TextBox")
        TextBox.Name = name .. "TextBox"
        TextBox.Size = UDim2.new(1, 0, 0, 40)
        TextBox.Position = UDim2.new(0, 0, 0, 25)
        TextBox.BackgroundColor3 = Color3.fromRGB(50, 50, 60)
        TextBox.BorderSizePixel = 0
        TextBox.Text = tostring(defaultValue)
        TextBox.TextColor3 = Color3.fromRGB(255, 255, 255)
        TextBox.TextSize = 14
        TextBox.Font = Enum.Font.Gotham
        TextBox.PlaceholderText = placeholder
        TextBox.Parent = Container

        local BoxCorner = Instance.new("UICorner")
        BoxCorner.CornerRadius = UDim.new(0, 8)
        BoxCorner.Parent = TextBox

        local BoxPadding = Instance.new("UIPadding")
        BoxPadding.PaddingLeft = UDim.new(0, 10)
        BoxPadding.PaddingRight = UDim.new(0, 10)
        BoxPadding.Parent = TextBox

        return TextBox
    end

    -- Basic spoofing settings
    local DisplayNameInput = createInputField("DisplayName", "Fake Display Name", Config.FakeDisplayName, 0)
    local UserNameInput = createInputField("UserName", "Fake Username", Config.FakeName, 80)
    local UserIdInput = createInputField("UserId", "Fake User ID", Config.FakeId, 160)
    local TargetPlayerInput = createInputField("TargetPlayer", "Target Player (leave empty for self)", Config.TargetPlayer, 240)

    local ApplyButton = Instance.new("TextButton")
    ApplyButton.Name = "ApplyButton"
    ApplyButton.Size = UDim2.new(1, 0, 0, 45)
    ApplyButton.Position = UDim2.new(0, 0, 1, -20)
    ApplyButton.BackgroundColor3 = Config.IsActive and Color3.fromRGB(255, 80, 80) or Color3.fromRGB(0, 170, 255)
    ApplyButton.BorderSizePixel = 0
    ApplyButton.Text = Config.IsActive and "Stop Spoofing" or "Apply Spoof"
    ApplyButton.TextColor3 = Color3.fromRGB(255, 255, 255)
    ApplyButton.TextSize = 16
    ApplyButton.Font = Enum.Font.GothamBold
    ApplyButton.Parent = ContentFrame

    local ApplyCorner = Instance.new("UICorner")
    ApplyCorner.CornerRadius = UDim.new(0, 8)
    ApplyCorner.Parent = ApplyButton

    local dragging = false
    local dragInput, dragStart, startPos

    TitleBar.InputBegan:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 then
            dragging = true
            dragStart = input.Position
            startPos = MainFrame.Position
            input.Changed:Connect(function()
                if input.UserInputState == Enum.UserInputState.End then
                    dragging = false
                end
            end)
        end
    end)

    TitleBar.InputChanged:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseMovement then
            dragInput = input
        end
    end)

    UserInputService.InputChanged:Connect(function(input)
        if input == dragInput and dragging then
            local delta = input.Position - dragStart
            MainFrame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
        end
    end)


    CloseButton.MouseButton1Click:Connect(function()
        shutdownSpoofer()
    end)

    CloseButton.MouseEnter:Connect(function()
        TweenService:Create(CloseButton, TweenInfo.new(0.2), {BackgroundColor3 = Color3.fromRGB(255, 100, 100)}):Play()
    end)

    CloseButton.MouseLeave:Connect(function()
        TweenService:Create(CloseButton, TweenInfo.new(0.2), {BackgroundColor3 = Color3.fromRGB(255, 60, 60)}):Play()
    end)

    ApplyButton.MouseButton1Click:Connect(function()
        if Config.IsActive then
            -- Deactivate spoofing
            deactivateSpoofing()
            ApplyButton.Text = "Apply Spoof"
            ApplyButton.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
        else
            -- Update configuration
            Config.FakeDisplayName = DisplayNameInput.Text
            Config.FakeName = UserNameInput.Text
            Config.FakeId = tonumber(UserIdInput.Text) or Config.FakeId
            Config.TargetPlayer = TargetPlayerInput.Text

            -- Activate spoofing
            activateSpoofing()
            ApplyButton.Text = "Stop Spoofing"
            ApplyButton.BackgroundColor3 = Color3.fromRGB(255, 80, 80)
        end
    end)

    ApplyButton.MouseEnter:Connect(function()
        if Config.IsActive then
            TweenService:Create(ApplyButton, TweenInfo.new(0.2), {BackgroundColor3 = Color3.fromRGB(255, 100, 100)}):Play()
        else
            TweenService:Create(ApplyButton, TweenInfo.new(0.2), {BackgroundColor3 = Color3.fromRGB(0, 200, 255)}):Play()
        end
    end)

    ApplyButton.MouseLeave:Connect(function()
        if Config.IsActive then
            TweenService:Create(ApplyButton, TweenInfo.new(0.2), {BackgroundColor3 = Color3.fromRGB(255, 80, 80)}):Play()
        else
            TweenService:Create(ApplyButton, TweenInfo.new(0.2), {BackgroundColor3 = Color3.fromRGB(0, 170, 255)}):Play()
        end
    end)

    return ScreenGui
end

-- Initialize only the UI, don't activate spoofing automatically
createModernUI()

Ratings & Reviews

No reviews yet. Be the first to review this script!

Comments (0)

Please login to comment

Login with Discord

Loading comments...