01 | local Time = "N/A" |
02 |
03 | while true do |
04 |
05 | if script.Parent.Value = = 0 then |
06 |
07 | script.Parent.ClickDetector.MaxActivationDistance = 32 |
08 |
09 | else |
10 |
11 | Time = script.Parent.Value - 1 |
12 | wait( 1 ) |
13 | script.Parent.Value = Time |
14 | script.Parent.SurfaceGui.TextLabel.Text = Time |
15 |
16 | end |
17 |
18 | end |
I see some things that I am able to fix up!
Here's the fixed code, let me know if it works!
01 | local Time = 'N/A' |
02 | local timestart = 30 --how many seconds it counts down from |
03 |
04 | for i = timestart, 1 , - 1 do |
05 | wait( 1 ) |
06 | Time = i |
07 | script.Parent.Value = Time |
08 | script.Parent.SurfaceGui.TextLabel.Text = Time |
09 | end |
10 |
11 | script.Parent.ClickDetector.MaxActivationDistance = 32 |
Also, if you're using a Server Script
then the TextLabel
's text will probably not update. Try handling everything related to GUIs via LocalScripts
.