The transparencies are working fine, it's just that whenever I click the button it will kill me (at least right now I know how to make a reset button). Can anyone find my problem?
local nameshowing=true
local fakehead=script.Parent.Parent.Parent.Parent.Character.Head:Clone()
local plr=script.Parent.Parent.Parent.Parent
script.Parent.MouseButton1Click:connect(function()
local shouldhidename = true
if nameshowing == true then
shouldhidename = true
else shouldhidename=false
end
if shouldhidename==true then
if plr.Character ~=nil then
if plr.Character:FindFirstChild("Head") then
plr.Character.Head.Transparency=1
fakehead.Parent=plr.Character
fakehead.Name = "FakeHead"
fakehead.CFrame=plr.Character.Head.CFrame
w=Instance.new("Weld",plr.Character.Head)
w.Part0 = plr.Character.Head
w.Part1 = fakehead
nameshowing = false
end
end
else
fakehead.Transparency = 1
plr.Character.Head.Transparency = 0
nameshowing=true
end
end)
Any help will be appreciated, thanks for your time.

4 comments
The script is inside the button inside a screengui, inside the startergui, which is inside the player so there are four parents. I think my problem here is the welds. But does it need to be inside a localscript in order for it to work?
I edited the message
Just moved my code to a LocalScript, thank you.
No problem ;)