Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
1

Accessory remover not working?

Asked by 5 days ago

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

Log in to vote
1
Answered by 4 days ago

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()

0
omg thank you, lmao im dumb SpeedyTV_1 76 — 4d
Ad

Answer this question