What's wrong with this? Have a similar one that is working in studio but not in game.
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
save = player.HatSave.Value
for i,v in pairs(player:GetChildren()) do
if v.ClassName == "Hat" and v.Name == save then
v.Parent = player.Character
end
end
wait(2)
for i,v in pairs(character:GetChildren()) do
if v.ClassName == "Hat" and v.Name ~= save then
v:Destroy()
end
end
end)

1 comment
thanks mate