Hello, I am making a game where the hats must be removed and I’m trying to make a script to do so. I am having trouble getting the hats to be removed, it doesn’t give me an error so I am not sure what I am doing wrong.
Here is the script:
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
while wait() do
local character = char:GetChildren()
if character.className == "Accessory" then
character:remove()
end
end
end)
end)