I am scripting an Intermission/Ingame timer for an FPS that i’m making, but i’m testing the Intermission script, which is almost identical to the Ingame script. During testing, i have found it always sets the number to 29, do you guys know the fix? Here is the code:
local StatusBar = game.StarterGui.TopFrame.Bar
local GameStatus = "Intermission"
local Time = 30
function GetPlayerCount()
Players = #game.Players:GetPlayers()
end
wait(1)
while true do
if GameStatus == "InGame" then
GetPlayerCount()
if Players == 1 or Time == 0 then
GameStatus = "Intermission"
Time = 30
elseif Players >= 2 or Time >= 0 then
local Time = Time - 1
print(Players)
print(Time)
print(GameStatus)
StatusBar.Text = Time
wait(1)
end
elseif GameStatus == "Intermission" then
GetPlayerCount()
if Players >= 2 or Time >= 0 then
local Time = Time - 1
print(Players)
print(Time)
print(GameStatus)
StatusBar.Text = "INTERMISSION ".. Time
wait(1)
elseif Players == 50 or Time == 0 then
GameStatus = "InGame"
Time = 300
end
end
end
Here is the output:
Note: I have done multiple server tests with different player amounts.
