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

Accessory remover not working?

So basicaly I made an accessory remover that removes your accessories once your character has been added to the game so it removes even after respawn. It should remove only if you are NOT on one specific team but it doesn't work and I don't know why.

game:GetService("Players").PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:connect(function(char)
		if plr.TeamColor ~= BrickColor.new("White") then
			for i,v in pairs(char:GetChildren()) do
				if v:IsA("Accessory") then
					v:Destroy()
				end
			end
		end
	end)
end)

1 answer

✓ Accepted answer

It is possible that when the character is added, not all the accessories have been loaded. You can fix that by simply doing:

game:GetService("Players").PlayerAdded:Connect(function(plr)
    plr.CharacterAppearanceLoaded:Connect(function(char)
        if plr.TeamColor ~= BrickColor.new("White") then
            for i,v in pairs(char:GetChildren()) do
                if v:IsA("Accessory") then
                    v:Destroy()
                end
            end
        end
    end)
end)

Also, there is a method in a Humanoid that already does this function: Humanoid:RemoveAccessories()

1 comment

0

omg thank you, lmao im dumb

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