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)

3 comments

0

Use prints to see what runs

0

Already did that, both of them do @gullet

0

works fine for me other than having to wait for CharacterAdded (since i was firing the event right away)