I would like to create a script that would link to GUI text, counting up by seconds.
I am aiming to create something like this, but counting up.
Also, I want to stop the timer when I collide with a certain object/part.
Here is what I have so far:
local time = 0 for i = 1, 89934 do wait(0.1) time = time + 0.1 script.Parent.Text = tostring(time) end
Location: StarterGUI>ScreenGUI>TextButton>Script
Also, the timer resets every time you die, is there a way to prevent this?
Thanks in advance, -MexheCo
StarterGui
called ResetPlayerGuiOnSpawn
. If unticked, the PlayerGui
(which holds the guis) will not reset. According to your hierarchy, you've use a server script to accomplish this, GUI coding is client-side only.--LocalScript under TextButton for i = .1, 10, .1 do script.Parent.Text = tostring(i) end
for
loop, the first .1 is the starting number, 10 is the desired number, and the last .1 is the increment. Not providing the increment will default it to 1.