Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why isn't my timer script isn't working?

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

2 comments

0

can you show the output errors?

0

there weren't any, it just wasn't changing the hint

1 answer

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.

###Example:

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"

This discussion is preserved as it was. New answers, comments, and votes are closed.