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

How do I make a "Change all players team" script??

Asked by
bx3t 2
4 years ago
local plrs = game.Players:GetPlayers()

plrs.TeamColor = BrickColor.new("Medium red")

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

plrs points to a table.

The plrs variable points to a table. All you are doing is adding a TeamColor field into the table.

What you want to do is traverse the table, so you can get a reference to a player one at a time, via a generic for loop.

for _, player in ipairs(players) do -- pls change plrs to players in your script it's more readable
    player.TeamColor = BrickColor.new("Medium red")
end

I hope I helped, and if I did, don't forget to hit that "Accept Answer" button below. This will really help me and you out.
Ad

Answer this question