Nametag gui not working?

Hello, so im working on a simple nametag changer for myself, the nametag itself is given to only me opon joining the game i’m trying to make a gui that allows me to change it to whatever text i want. Here is the script

local staff = script.Parent.Parent.Parent.Parent.Parent
local text = script.Parent.TextBox.Text
local textbox = script.Parent.TextBox

function leftClick()
staff.Head.Nametag1.Text = text
end
 

 
script.Parent.MouseButton1Click:Connect(leftClick)```

Here is what the gui looks like, ![image|179x102](upload://fo9JS28z9p0EiMsyjBIr4kFNhbr.png) 

any fixes/help?

it erroring with Head not a valid member of player

Can I see the explorer for this?

I’m assuming the script is under the player, which means you will need to get the character.
Body parts are all parented to the Character.

Try using this instead
local character = staff.Character or staff.CharacterAdded:Wait()
character.Head.Nametag1.Text = text

1 Like

A tip is to avoid things like:

Parent.Parent.Parent.Parent

Because it get’s very confusing and if you change the scripts location it will break. I usually use the playerGUI as a starting folder and move down from there.

1 Like