Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Hat remover script not removing hats why?

game.Players.PlayerAdded:connect(function(plr)
	for i,v in pairs(plr.Character:GetChildren())do
		if v.ClassName == "Hat" or v.ClassName == "Accountrement" then
			v:Destroy()
		end
	end
end)

i am trying to make a script that deletes all the hat player has when he joins the game but this script will not work please help.

1 answer

The hat class has been replaced with the Accessory class. You also spelled Accoutrement wrong.

game.Players.PlayerAdded:connect(function(plr)
	plr.CharacterAdded:connect(function(character)
	    for i,v in pairs(character:GetChildren())do
	        if v.ClassName == "Accoutrement" then
	            v:Destroy()
	        end
	    end
	end)
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.