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

Say I want all the players accessories off them when they first join, how would I go about that?

I haven't scripted for about 7 months so im not sure if this would be good at all

I'm pretty sure its along the lines of

Players = game.Players
Players.CharacterAdded:Connect function()
Player.Character.Hair:Remove()
etc
etc
end

I was hoping to atleast find a tutorial on youtube or something but I mean I could always just rip an accessory/face remover from the workshop and put it where the player spawns, that could actually work why dont I just do that? genius

im gonna post this anyway for advice but im still trying that epiphany I thought of just now

okay bye

2 answers

You can use a for loop to iterate through the Character's children, and delete their accessories like so;

game.Players.PlayerAdded:Connect(function(player)
	local char = player.Character
	for _,v in pairs(char:GetChildren()) do
		if v:IsA("Accesory") then
			v:Destroy()
		end
	end
end)

3 comments

0

do I put this in a localscript or a server script and in which folder?

0

Server Script, put it anywhere that Server Scripts can run.

0

as a side note to this great answer, you can replace the for loop with simply: Character.Humanoid:RemoveAccessories()

Kind of like what zboi said, I'd do something like this:

game.Players.PlayerAdded:Connect(function(Plr)
Plr.CharacterAdded:Connect(function(Char)
Plr.CharacterAppearanceLoaded:Wait()
Char.Humanoid:RemoveAccessories()
end)
end)

1 comment

0

Also it'd go in a ServerScript.

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