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

Killing all players in that one team script doesn't work?

Asked by 7 years ago

for i, v in pairs(game.Players:GetChildren()) do if v:IsA("Player").TeamColor==BrickColor.new("Really red") then v.Character.Humanoid.Health=0 end end It says this :

19:06:45.138 - Workspace.Script:11: attempt to index a boolean value

0
Dude, I can clearly tell that you aren't showing your full code greatneil80 2647 — 7y

3 answers

Log in to vote
0
Answered by 7 years ago

I think it's "Really Red" Other than that, I don't know,

0
It's Really red, the only problem is the bolean thing. TinfoilbotGamer 35 — 7y
0
Are you sure it's referencing that script? It could be talking about something else that is causing this script to fail 0HappyManDudeguy0 15 — 7y
0
the 2and word in all BrickColors is always uncapitalized lukeb50 631 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

I really need help, if anyone found any solution please send.

Log in to vote
0
Answered by
lukeb50 631 Moderation Voter
7 years ago
Edited 7 years ago

Please use a code block in the future. It helps us read your code properly

for i, v in pairs(game.Players:GetChildren()) do
    if v:IsA("Player").TeamColor==BrickColor.new("Really red") then                         
        v.Character.Humanoid.Health=0
    end
end

Let me re-write line 2 as lua would understand it

if true.TeamColor==BrickColor.new("Really red") then

See a problem there? v.IsA("Player") is converted to true and then the next part is analyzed. This check is useless anyways unless you are adding stuff to game.Players, something you should not do. If you really need to add stuff in there for some reason, use this code:

for i, v in pairs(game.Players:GetPlayers()) do
    if v.TeamColor==BrickColor.new("Really red") then                       
        v.Character.Humanoid.Health=0
    end
end

Answer this question