Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is the player's accessories not going away?

Asked by 5 years ago

So basically, this is in the server script service, I am wondering why this code is not removing the player's accessories. There are no errors.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TeamChangeEvent = ReplicatedStorage:WaitForChild("TeamChangeRemoteEvent")

function OnTeamChangedEvent(Player, ColorToChange)
    Player.TeamColor = BrickColor.new(ColorToChange)
end

function OnConvictCharacterOverrideEvent(Player, ColorToChange)
    if Player.TeamColor == BrickColor.new("Bright orange") then
        for i,v in pairs(Player.Character:GetChildren()) do
            if v:IsA("Accessory") then
                v:Destroy()
            end
        end
    end
end

TeamChangeEvent.OnServerEvent:Connect(function(Player, Color)
    OnTeamChangedEvent(Player, Color)
    OnConvictCharacterOverrideEvent(Player, Color)
end)
0
Use prints to see what runs gullet 471 — 5y
0
Already did that, both of them do @gullet Flakezzz 4 — 5y
0
works fine for me other than having to wait for CharacterAdded (since i was firing the event right away) User#22604 1 — 5y

Answer this question