Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My intermission timer automatically stops ticking, how can I fix this?

Asked by 4 years ago

I'm making an intermission for my round-based game. So, like any intermission, I have a timer GUI. It's supposed to tick down for 15 seconds and when it gets to 0, it will teleport all players to the map.

The problem is, the TextLabel which I set the text to display the intermission timer's value will automatically stop ticking at 14. Can someone help? Here's my code:

01repstorage = game.ReplicatedStorage
02timer = game.StarterGui.RoundTimer.TimerText
03 
04local intermission = Instance.new("IntValue")
05    intermission.Name = "Intermission"
06    intermission.Value = 15
07    intermission.Parent = game.ReplicatedStorage
08 
09function countdown()
10    repeat
11        intermission.Value = intermission.Value - 1
12        timer.Text = intermission.Value
13            wait(1)
14    until intermission.Value == 0
15 
View all 21 lines...

go easy on me

2 answers

Log in to vote
0
Answered by 4 years ago

You have to access the player's playerGui, not the starterGui!

Try this:

01repstorage = game.ReplicatedStorage
02 
03local intermission = Instance.new("IntValue")
04    intermission.Name = "Intermission"
05    intermission.Value = 15
06    intermission.Parent = game.ReplicatedStorage
07function updateGui()
08    for x,y in pairs(players) do -- goes thru all the players (x = key, y = the player)
09        y.PlayerGui.RoundTimer.TimerText.Text = intermisson.Value -- Updates the gui
10    end
11end
12function countdown()
13    players = game.Players:GetChildren() -- I added this table of all the players
14    repeat
15        intermission.Value = intermission.Value - 1
View all 25 lines...

Plz accept! (If it helped)

0
The starterGui won't change anything unless a player rejoins or dies R_LabradorRetriever 198 — 4y
0
This worked! Thanks for the help, and thanks for making it very clear. ;) jaackharm 42 — 4y
0
:D R_LabradorRetriever 198 — 4y
Ad
Log in to vote
0
Answered by
Aztralzz 169
4 years ago

Maybe try this, I have an intermission script and it works fine.

01local timer = game.StarterGui.RoundTimer.TimerText
02 
03function intermission()
04for i = 15,0,-1 do
05timer.Text = ""..i..""
06wait(1)
07end)
08while true do
09intermission()
10wait(1)
11end

This should work. But it doesn't do it every time a player joins. Good Luck!

Answer this question