Rounds and intermissions scripts not working

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:
Desktop Screenshot 2021.05.16 - 19.32.32.81 Desktop Screenshot 2021.05.16 - 19.32.14.88

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!

Could you check your Output for any potential errors you may come across?

Currently this shows up:

Hm, I mean it should work fine? What’s exactly not working here?

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.

Could you try this and see if anything prints?

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.)

In output? If so, it doesn’t.

30charlimitoof

Only the plugin errors are in the output.

Might be the spawn function, can you try this?

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

What is the line that runs the function on referring? Did you give us the full script? What’s the spawn(roundTimer) for?

To run functions you just put the name followed with (), example :

roundTimer()

Hope this is your solution

Something seems to be working there

Ok dumb question, but is InRound & Status both StringValues?

(Yeah might wanna crop that out)

I have no idea lol. I am extremely bad at scripting :sweat_smile:

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.

I’ll try. I dont understand it though, the tutorial did exactly what i did and it worked fine. Roblox might have changed something?

Its definitely because the client can’t access serverstorage and thus won’t detect any changes

I suggest moving it to workspace instead.

The values are in replicated storage…

Desktop Screenshot 2021.05.16 - 19.32.14.88

U m s i r d i d y o u l o o k

@UXZ16 All I’d do is just keep adding print() statements, to check what works & what doesn’t

This is a weird occurrence to say the very least :thinking:

1 Like

Sorry I must’ve misread, not sure why its not working then