I don't see whats wrong with this the hat is in serverstorage in a folder called DonatorItems and the hat is called Coney.
wait(2) gpid = 235360162 hats = {"Coney"} GPS = game:GetService("GamePassService") function respawned(char) player = game.Players:FindFirstChild(char.Name) if char:FindFirstChild("Head") ~= nil then if GPS:PlayerHasPass(player, gpid) then for i = 1,#hats do game.ServerStorage:FindFirstChild(hats[i]):Clone().Parent = player end else end end end game.Workspace.ChildAdded:connect(respawned)
It seems that you might have already had your question answered. However, I'd like to suggest some code changes.
The first one:
wait(2)
I'd assume that you're waiting for something more specific than that, so I'd suggest making it wait for a specific object or condition, rather than just an arbitrary amount, in order to ensure that your script is more robust.
I'd also suggest that you use game.Players:GetPlayerFromCharacter(char)
, rather than using FindFirstChild
to locate the object.