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

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

Asked by 6 years ago
Edited 6 years ago

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:

1local ltime = script.Parent.Value
2 
3while true do
4    script.Parent.Text = "Time alive:"..ltime
5    wait(1)
6    ltime = ltime + 1
7end

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

Log in to vote
0
Answered by 6 years ago

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

1local textbox = script.Parent
2local timealive = 0
3 
4while true do
5    textbox.Text = ("Time alive:" .. timealive)
6    wait(1)
7    timealive = timealive + 1
8end
Ad

Answer this question