My script is supposed to give your character a certain hat if you own a gamepass. There is a hat in serverstorage called cap that you get. I also have a character override script in use if that helps.
gpid = 339516128
hats = {"Cap"}
GPS = game:GetService("GamePassService")
function respawned(char)
char = game.Players:FindFirstChild(char.Name)
if char:FindFirstChild("Head") ~= nil then
if game:GetService("MarketplaceService"):PlayerOwnsAsset(char,gpid) then
for i = 1,#hats do
game.ServerStorage:FindFirstChild(hats[i]):Clone().Parent = char
end
else
end
end
end
game.Workspace.ChildAdded:connect(respawned)

5 comments
The script worked, but what I was hoping for was that they get it after respawning too.
If you reset it won't give you it
Edited, it will now do that.
Now it won't give the hat to he character at all.
nvm it worked! ty!