In reality I want that is the player is not in the red team weapons with a marker "Terrorist" this destroys, how to make this?
The problem is to line 08 and i don't know how fix this bug..
My testing script:
workspace.ChildAdded:connect(function(object)
local NewPlayer = game.Players:playerFromCharacter(object)
if NewPlayer then
if NewPlayer.TeamColor == BrickColor.new("Bright red") then
else
for i,AllGear in pairs(NewPlayer.Backpack:GetChildren()) do
for i,v in pairs(AllGear:GetChildren()) do
if v:FindFirstChild("Terrorist") then
v:Destroy()
end
end
end
end
end
end)

8 comments
Define Beta Script? You should be able to work of this. Have you tried it?
Yes
And it not work
From glancing over the code, you have an "else" on line 5: if you want the script to work if the player is on the red team, I recommend you removed that line. :P
It should not remove the weapons of the player in red team.. Just if the player is not in the red team so i don't remove this lines. The problem is to line 08 and i don't know how fix this bug..
What's AllGear? And does whatever in AllGear (the current instance being iterated through) have a child named "Terrorist"? If not, then that's more than likely your problem.
The code is fine, from what I see. The code is looking through everything in the player's backpack for "Terrorist". Are you sure that value is present?
Yes, in the weapons than i want destroy if the player is not in the red team, but not in all weapons