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

Timer GUI not updating on screen, only in properties. Why is that?

Asked by 3 years ago
Edited 3 years ago

I am trying to make my own timer with the knowledge I have as of right now and it all seems fine to me but for some reason the label on screen is not updatind as well as not turning invisible while, but in properties it is. Could I get some help or explanation as to why it's behaving like that? All of the printing works as well.

All of the code bellow is placed in ServerScriptService

wait(10)

local timerLabel = game.StarterGui.timerGUI.timerLabel

local timer = 30
local timerEnd = -1

repeat
    timerLabel.Text = timer
    print(timer)
    wait(1)
    timer = timer - 1

until timer == -1

timerLabel.Visible = false

print("Timer ended!")

1 answer

Log in to vote
1
Answered by 3 years ago

You cant change the player's gui from StarterGui. You need to change it from the PlayerGui in each client. The StarterGui is used to replicate the Gui to the player's PlayerGui when they join.

game.Players.PlayerAdded:Connect(function(player)
    wait(10)

    local timerLabel = player.PlayerGui.timerGUI.timerLabel

    local timer = 30
    local timerEnd = -1

    repeat
        timerLabel.Text = timer
      print(timer)
     wait(1)
     timer = timer - 1

    until timer == -1

    timerLabel.Visible = false

    print("Timer ended!")
end
Ad

Answer this question