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

how to remove all the players hats when they respawn or reset?

i've tried

plr.Character.ChildAdded:connect(function(child)
	if child.ClassName == "Hat" then
		repeat wait() until child.Handle
		child:Destroy()
	end
end)

and it works mostly but sometimes it doesnt

1 comment

0

So, did it work?

1 answer

✓ Accepted answer

I'd use this code, it may not work, but I tried:

game.Workspace.ChildAdded:connect(function(plr)
	local name = plr.Name
	local playerinplayers = game.Players:FindFirstChild(plr.Name)
	playerinplayers.CanLoadCharacterAppearance = false
	for i,v in pairs(plr:GetChildren()) do
		if v:IsA("Hat") then
			v:Destroy()
		end
	end
end)

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