So I want to make a hat remover script when you spawn so I have this script but I get a
Workspace.Script:6: attempt to index local 'players' (a nil value) error
function PlayerRespawned(Player)
local players = game.Workspace:FindFirstChild(Player)
wait(1)
print('hi')
print(Player)
local d = players:GetChildren() -- start of hat remover
for i=1, #d do
if (d[i].className == "Hat") then
d[i]:remove()
print('hat removed')
end
end -- end of hat remover
end

1 comment
Don't come on this site with free model code, expecting for it to be fixed.