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

I'm trying to make a timer, but it isn't working. Number values aren't working either. Why is this?

So I'm trying to make a timer, but the code isn't working. I've tried adding a number value, but it didn't work. Here is my script:

local ltime = script.Parent.Value

while true do
	script.Parent.Text = "Time alive:"..ltime
	wait(1)
	ltime = ltime + 1
end

Also, forgot to mention this, the textbox's text only says "TextBox".

If you need the order of the things that I have in the StarterGUI, click the link here.

1 answer

You're trying to store an integer value in a Value field, and a string value in a Text field. No instance has both of those properties.

Now, assuming you put this script inside of a TextBox

local textbox = script.Parent
local timealive = 0

while true do
	textbox.Text = ("Time alive:" .. timealive)
	wait(1)
	timealive = timealive + 1
end

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