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

is this the right way to make this script?

Asked by
Prioxis 673 Moderation Voter
10 years ago
local numPlayers = 0

for i, v in next, game.Players:GetPlayers() do
if v:FindFirstChild("TeamColor") == BrickColor.new("Bright red") then
numPlayers = numPlayers + 1
elseif v:FindFirstChild("TeamColor") ~= BrickColor.new("Bright red") then
    numPlayers = numPlayers - 1
end
end

if numPlayers == 0 then

local player = game.Players:GetPlayers()

local pickedPl = math.random(1, #player)
pickedPl.TeamColor = BrickColor.new("Bright red")
end -- I think..
wait(60)
a = game.Players:GetChildren()
for i = 1,#a do
    player = a[i]
    player.Neutral=true
    player.TeamColor=BrickColor.new("White")
    game.Workspace[a[i].Name].Torso.Name=("")
end

Would I put the end with the comment next to it there?

0
Its suppose to be a team chooser w/ 60 second round script... Prioxis 673 — 10y

2 answers

Log in to vote
0
Answered by 10 years ago

Do not only post code, or only post an explanation. Both are required to make a good question.

Ad
Log in to vote
0
Answered by 10 years ago

Do not only post code, or only post an explanation. Both are required to make a good question.

Also, you can use "game.Players.NumPlayers" for get the total players connected!

Answer this question