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

How can I make it so when it reaches ten, the restart script works?

-- The parent is TextLabel, TextLabel's parent is ScreenGui, ScreenGui's parent is StarterGui

Timer = 0
while Timer <10 do
Timer = Timer + 1
 Wait(1)
script.Parent.Text = (Timer)
end
-- This is the part that isn't working (below)
while Timer == 10 do
wait(1)
Game.workspace.Sound:play()
wait(1)
Timer = Timer - 9 
wait(10)
script.Parent.Text = (Timer)
end





3 comments

0

I don't know why it's not showing it in the roblox format. Sorry

0

You can put it in a code block (the button with the Lua symbol) to show it in code format.

0

Edited to put the code in a code block.

2 answers

✓ Accepted answer

Try this

Timer = 0
while Timer < 10 do 
  Timer = Timer + 1 
    wait(1)
      print(Timer)
      if Timer == 10 then 
    Timer = 0
   game.Workspace.Sound:play()
  wait(1)
 end
end

using if statements is easier than what you did. If this does work please hit the [Accept Answer] button below.

for i = 0, 10, 1 do 
	Timer = i
	wait(1)
	if Timer == 10 then 
		game.Workspace.Sound:Play()
	end
end

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