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

How to delete accesories on local player in local script?

Hello. How do you delete accessories on the local player in a local script? Is it something like:

game.Players.LocalPlayer.CharacterAdded:Connect(function()
	local plr = game.Players.LocalPlayer.Character
	if plr.Accessory then --Not sure what to do at this part and after, I don't even think this is how you put it.
		Accessory:Destroy()
		--??? ... That can't be right...
	end
end

I'm sure thats not how you do it. But any help from you is appreciated, thanks.

2 answers

✓ Accepted answer

This is my way of doing it. If it doesn't work then I made an error on my end

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

Cheers! Zander.

2 comments

0

There is an error: It says character is not a valid member of plr in line 3 of your example - Wait, never mind, I fixed it myself, thanks.

0

Okay!

Have you tested it? Because this looks like it should work

1 comment

0

It doesn't work.

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