Hello developers! I am working on a game with rounds.
I’m VERY new to scripting, I know close to nothing.
For the game I am using this tutorial.
I’ve made the scripts exactly like the video shows, but it doesn’t work.
This is what my explorer looks like:
The Script in ServerScriptService:
local roundLength = 5 -- How long the round is in seconds
local intermissionLength = 10 -- How many seconds are inbetween the rounds
local InRound = game.ReplicatedStorage.InRound
local Status = game.ReplicatedStorage.Status
local LobbySpawn = game.Workspace.LobbySpawn
local GameAreaSpawn = game.Workspace.GameAreaSpawn
local function roundTimer()
while wait() do
for i = intermissionLength, 1, -1 do
InRound.Value = false
wait(1)
Status.Value = "Intermission: ".. i .." seconds left!"
end
for i = roundLength, 1, -1 do
InRound.Value = false
wait(1)
Status.Value = "Game: ".. i .." seconds left"
end
end
end
spawn(roundTimer)
. The LocalScript in StarterGui
local Status = game.ReplicatedStorage.Status
local TimerDisplay = script.Parent.TimerDisplay
Status.Changed:Connect(function()
TimerDisplay.Text = Status.Value
end)
.
I can’t figure out the problem.
Thanks for helping!
The textlabel on the GUI is supposed to show either intermission or game and then how many seconds are left. Yet it keeps only showing Label. It doesn’t change.
local Status = game.ReplicatedStorage.Status
local TimerDisplay = script.Parent.TimerDisplay
Status.Changed:Connect(function()
print("Changed")
TimerDisplay.Text = Status.Value
print(Status.Value)
end)
Hi, is there anything else in your output, apart from the plugin errors(I recommend removing unused plugins from your studio when developing so you don’t get errors like that in the future.)
print("Script running")
local roundLength = 5 -- How long the round is in seconds
local intermissionLength = 10 -- How many seconds are inbetween the rounds
local InRound = game.ReplicatedStorage.InRound
local Status = game.ReplicatedStorage.Status
local LobbySpawn = game.Workspace.LobbySpawn
local GameAreaSpawn = game.Workspace.GameAreaSpawn
print("Variables online")
while wait() do
print("Yes")
for i = intermissionLength, 1, -1 do
InRound.Value = false
wait(1)
Status.Value = "Intermission: ".. i .." seconds left!"
end
for i = roundLength, 1, -1 do
InRound.Value = false
wait(1)
Status.Value = "Game: ".. i .." seconds left"
end
end
So did you get the solution? If Jack’s solution did not work, try what I did. You were correct in your original script, you just ran the function incorrectly.
Also whenever you get the solution mark it with the solution “reaction” so people know not to reply to this in future.