I am testing this hat GUI giver thing and it works perfectly fine in studio test, while I test it in server client though... It gives me this error and does not delete the hat off of the character while clicking the arrow:
attempt to index upvalue "character" (a nil value)
here is the line of code where the error is coming from:
local character = game.Players.LocalPlayer.Character
local hat = game.Players.LocalPlayer.Hat
hat.Changed:Connect(function()
for i, v in pairs(character:GetChildren()) do
if v.ClassName == "Hat" then
v:Destroy()
end
end
end)

2 comments
You should add findifrstchild and if hat then first, these small things can fix a script.
Doesn't work...