I am working on a timer script, but when I try to change a hint's text or a gui text it won't work, in this case I am using a hint, but I have tried with a gui and i still fail, I have even tried strings.
hint = Instance.new("Hint") hint.Parent = game.Workspace guilabel = hint.Text waiting = game.ServerStorage.waiting.Value intermission = 30 gametimer = 60 gametype = game.ServerStorage.gametype.Value wait(1) guilabel = "text" while true do wait(1) if waiting == true then if intermission > -1 then guilabel = "Intermission " ..intermission --making hint say "Intermission (number)" intermission = intermission - 1 print(intermission) --printing it to test else waiting = false intermission = 30 --reseting the intermission end elseif gametype == 1 then if gametimer > -1 then guilabel = gametimer --same thing here gametimer = gametimer - 1 print(gametimer) else waiting = true gametimer = 60 -- reseting end end end
Your problem has to do with your variable guilabel
. What you have done is set it to the value stored in hint's Text
property. To make this work correctly, you should set hint.Text
to whatever you want it to be.
local hint = Instance.new("Hint") hint.Text = "The text you want"
Rather than:
local hint = Instance.new("Hint") local text = hint.Text -- Stores the value in the variable text = "Updates variable value, not the hint's Text"