Removing player's accessories on spawn?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve?
    Removing Player’s accessories on spawn.

  2. What is the issue?
    No errors, but wont do anything

  3. What solutions have you tried so far?
    I honestly got no idea… I cant seem to see whats wrong with this

game.Players.PlayerAdded:Connect(function(plr)
	
	plr.CharacterAdded:Connect(function()
		for i, v in pairs(plr.Character:GetChildren()) do
			if v:IsA("Accessory") then
				v:Destroy()
			end
		end
	end)
	
end)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Add a yield right after the plr.CharacterAdded:Connect(). The character and its children don’t actually spawn IMMEDIATELY upon .CharacterAdded.

1 Like

by yield do you mean wait()?

wait(1)
plr.CharacterAdded:Connect()
1 Like

All you have to do is delay the the script to wait for the characters children to load in.

No, it means it waits until the accessories of the character loads. However, I suggest you use CharacterAppearanceLoaded instead.

The reason can be found in it’s devhub page:

This event will fire when all such objects have been inserted into the Player.Character .

5 Likes

This will actually work! Thank you for helping me out
didnt know about that one xd

2 Likes