Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

RP Name changer not working. I tried different techniques?

Asked by 4 years ago

There is no errors in the output but when I type in the name and click set it doesn't change above their head. If you need more information like the other parts feel free to ask.

local guibase  = script.Parent:Clone()

--Detect when a player is added.
game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:connect(function()
        repeat wait() until player.Character
        local char = player.Character

        --Insert gui into player.
        local gui = guibase:Clone()
        gui.Parent = player.PlayerGui

        --Setup name.
        local mod = Instance.new("Model")
        local hum = Instance.new("Humanoid")
        local head = Instance.new("Part")

        --Insert humanoid into model.
        hum.Parent = mod

        --Set initial name to be blank.
        mod.Name = ""

        --Set head properties.
        head.Size = Vector3.new(1,1,1)
        head.CanCollide = false
        head.Transparency = 0.99
        head.Name = "Head"
        head.Parent = mod

        --Finish model setup.
        mod.PrimaryPart = head
        mod.Parent = char
        mod:SetPrimaryPartCFrame(char.Head.CFrame+Vector3.new(0,0.5,0))

        --Weld part to character.
        local w = Instance.new("Weld")
        w.Name = ("Weld")
        w.Part0,w.Part1 = head,char.Head
        w.C0 = head.CFrame:inverse()
        w.C1 = char.Head.CFrame:inverse()
        w.Parent = head

        --Add server side handling to model.
        local svh = gui.ServerHandler
        svh.Parent = mod
        svh.ServerHandler.Disabled = false
        gui.HandlerPointer.Value = svh

        --Enable local handler to finish setup.
        gui.LocalHandler.Disabled = false
    end)
end)

Answer this question