I have an issue that when I join my game, the intermission doesn’t go down by 1. It is the same with the other timers.
Script:
local InGame = game.ReplicatedStorage.InGame
local FloorGlass = game.Workspace.GameSpawn.FloorGlass
local gameRoundTimer = 5
local roundLength = 5
local intermissionLength = 10
local InRound = game.ReplicatedStorage.InRound
local Status = game.ReplicatedStorage.Status
local RoundEnd = game.ReplicatedStorage.RoundEnd
local LobbySpawn = game.Workspace.LobbySpawn
local GameAreaSpawn = game.Workspace.GameSpawn.GameAreaSpawn
RoundEnd.Changed:Connect(function()
if RoundEnd == true then
Status.Value = "Game Over!"
local Controls = require(game.Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule")):GetControls()
Controls:Disable()
end
end)
InGame.Changed:Connect(function()
if InGame.Value == true then
FloorGlass.Transparency = 1
FloorGlass.CanCollide = false
wait(5)
FloorGlass.Transparency = 0.5
FloorGlass.CanCollide = true
end
end)
InRound.Changed:Connect(function()
if InRound.Value == true then
for _, player in pairs(game.Players:GetPlayers()) do
local char = player.Character
char:WaitForChild("HumanoidRootPart").CFrame = GameAreaSpawn.CFrame * CFrame.new(0,3.25,0)
end
else
for _, player in pairs(game.Players:GetPlayers()) do
local char = player.Character
char:WaitForChild("HumanoidRootPart").CFrame = LobbySpawn.CFrame * CFrame.new(0,3.25,0)
end
end
end)
local function roundTimer()
while wait() do
InRound.Value = false
for i = intermissionLength, 0, -1 do
wait(1)
Status.Value = "Intermission: ".. i .." seconds left!"
wait(10)
InRound.Value = true
end
for i = gameRoundTimer, 0, -1 do
wait(1)
Status.Value = "Dropping Players: ".. i .." seconds left!"
wait(5)
InGame = true
end
for i = roundLength, 0, -1 do
wait(1)
Status.Value = "Game: ".. i .." seconds left!"
wait(5)
RoundEnd = true
end
end
end
coroutine.wrap(roundTimer)()
Try implementing this script for your roundTimer function:
local function roundTimer()
while wait() do
InRound.Value = false
for i = intermissionLength, 0, -1 do
wait(1)
Status.Value = "Intermission: ".. i .." seconds left!"
end
InRound.Value = true
for i = gameRoundTimer, 0, -1 do
wait(1)
Status.Value = "Dropping Players: ".. i .." seconds left!"
end
InGame = true
for i = roundLength, 0, -1 do
wait(1)
Status.Value = "Game: ".. i .." seconds left!"
end
RoundEnd = true
end
end
InRound.Value = false
for i = intermissionLength, 0, -1 do
wait(1)
Status.Value = "Intermission: ".. i .." seconds left!"
if i = 0 then InRound.Value = true end
end
So the loop that is created is counting down from 10, and every 1 second it should update the value. If you have a wait(10) it is going to wait 10 seconds before moving on.
Yeah you could but it’s unnecessary since after the loop has finished that is essentially waiting 10 seconds anyway. So what ever you need to do after 10 seconds you would just add it after the loop.