I am quite new to roblox scripting, I'm experienced with A similar language (Zero) in the past but don't know what to do here
This script is making a time variable for the entire scripts
time = 0 -- A time Variable for throughout the entire Workspace
while true do -- True boolean to repeat it all
time = time + 1 -- add 1 to the time
wait(1) -- wait .9 seconds in order to not overload the script
if time == 820 then -- Makes sure the round can't go longer than 12 minutes
time = 0 -- sets the time Variable back to 0
end --ends the if statement
print(time) --Prints "time" for debugging
end -- ends the While true
this is one of the many places I'm using that script
playerNames = game.Players:GetChildren() --Find the names of all the players
function kill() -- Kill all players
for i = 1, #playerNames do --repeat until all the players are killed
game.Workspace[playerNames[i].Name].Humanoid.Health = 0 --kill the player
end ----finished
end -- Ends the kill() function
while true do
if time >= 90 then --Time for people to choose character
kill() -- Runs the kill() function
if time >= 820 then
for i=1, #playerNames do
playerNames[i].TeamColor = BrickColor.new("White")
end --Ends the "for" statement
kill() -- Runs the kill() function
end --Ends this "if" statment
end -- Ends the "if" statement
end

2 comments
On line 3, get a new list of players to kill instead of only using the initialized list which won't include everyone. Something like "for i, v in pairs(game.Players:GetChildren()) do" .
To make it clear, I want to know how to use 1 variable throughoutt the entire script