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

How to delete accesories on local player in local script?

Asked by 3 months ago

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

Log in to vote
1
Answered by 3 months ago

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.

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. StirSavvy 31 — 3mo
0
Okay! Cynical_Innovation 597 — 3mo
Ad
Log in to vote
0
Answered by 3 months ago

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

0
It doesn't work. StirSavvy 31 — 3mo

Answer this question