I was trying to make a countdown script for a round game, but it didn’t work as planned. The countdown isn’t shown on a GUI, instead it is an object in the game.
Nothing happens when the script runs.
Round script inside serverscriptservice:
local roundLength = 15
-- set to smaller values to save time while testing
--How long the rounds are - later set to 90 for 90 seconds
local intermissionLength = 5
-- How long the intermmison is - later set to 15 for 15 seconds
local inRound = game.ReplicatedStorage.InRound
local status = game:GetService("ReplicatedStorage").Status
local lobbySpawn = game.Workspace.Base.Spawns
-- make sure to specify the spawns with a for loop
local gameAreaSpawn1 = workspace.Voice.Playplace.VoiceTeleport
local gameAreaSpawn2 = workspace.Challenge.Playplace.ChallengeTeleport
--this teleports to the actual game area
local function roundTimer()
while wait() do
for i = intermissionLength, 1, -1 do
inRound = false
wait(1)
status.Value = "Intermission: " .. i .. " seconds left!"
--intermission countdown
end
for i = roundLength, 1, -1 do
inRound = true
wait(1)
status.Value = "Game: " .. i .." seconds left!"
-- round countdown
end
end
end
Here is the other script, inside the SurfaceGui in the countdown block.
local status = game.ReplicatedStorage.Status
local timerDisplay = script.Parent.TimerDisplay
print(script.Parent.TimerDisplay.Text)
status.Changed:Connect(function()
status.Value = timerDisplay.Text
print(status.Value)
end)
I tried debugging it and it seems that the changed function never runs, if that is of assistance.
Please inform me if you need more info to assist, and of what.