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

Why is my script not removing the player's hats?

First I just had the script remove the player's hats when the character was added:

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		char.Humanoid:RemoveAccessories()
	end)
end)

Then I had it wait for the child humanoid, and also had it remove it a second time just in case.

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		char:WaitForChild('Humanoid'):RemoveAccessories()
		char.Humanoid:RemoveAccessories()
	end)
end)

Neither of these remove the player's accessories.

1 answer

✓ Accepted answer

Add a wait() statement to it. It is removing the accessories before they even load in so they just load in.

3 comments

0

It's doing it, except for the first time a player loads in.

0

Just add a longer wait so for example wait(1) or wait(2), should fix this.

0

Alternatives that may be worthwhile investigating are, the Player's "CharacterAppearanceLoaded" event and the "HasAppearanceLoaded" function (looping until the function returns true)?

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