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

How would I make this stop at 0 and reset to 30?

So ive been messing about with this for about half an hour.. The script is inside a text lable and works well, but when it gets to zero it goes to negative numbers, I dont want this. I need it to reset to 30 and the countdown notice to change.

Any tips on how I can adapt my script to do this? Thanks in advance.

while true do

script.Parent.Text = script.Parent.Text -1
wait (1.1)
end

3 answers

✓ Accepted answer
while true do
	for i=30,0,-1 do
		script.Parent.Text=i
		wait(1.1)
	end
end

Counts down from 30 and displays it on the TextLabel. This part loops forever.

1 comment

0

Thanks for your reply, But I need the countdown to start at 180 and go to 0 and then when it reaches 0 starts again at 30? I guess it was my fault not explaining it porpperly.

repeat -- might be wrong uh..
script.Parent.Text = script.Parent.Text -1
wait (1)
until script.Parent.Text = 0

Try using it this way.

--script.Parent.Text = 30
Seco = 0

while true do
	Seco = Seco +1
	script.Parent.Text = script.Parent.Text -1
	if Seco == 30 then
		script.Parent.Text = 30
	end
	wait (1.1)
end

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