Flashing TextLabel Help

(Sorry for the confusing title I didn’t really know how to title my problem)
For the past week I’ve been making a game and had the idea to make the round timer flash red and white for the final 10 seconds of the round; however, whenever it gets to the final 10 seconds (when the text is supposed to flash red and white) the timer stops counting. I’ve been at this for about an hour and decided to ask for help.

Because I’m not good at describing things I’ll leave the code and a video of the problem below.

Full Script
t = game.Workspace["Game time stuff"].Time.Value

repeat
	
	t = game.Workspace["Game time stuff"].Time.Value
	script.Parent.Text = "Intermission: "..t
	wait(0.01)
	
	if game.Workspace["Game time stuff"].Time.Value == 150 then
		
		repeat
			
			t = game.Workspace["Game time stuff"].Time.Value
			script.Parent.Text = "Time till day: "..t
			wait(0.01)
			
			if game.Workspace["Game time stuff"].Time.Value == 10 then
				
				repeat
					
					script.Parent.TextColor = "Really Red"
					wait(1)
					script.Parent.TextColor = "White"
					wait(1)
					
				until game.Workspace["Game time stuff"].Time.Value == 1
				
				
			end
			
		until game.Workspace["Game time stuff"].InGame.Value == 1
	
	else
		
		t = game.Workspace["Game time stuff"].Time.Value
		script.Parent.Text = "Intermission: "..t
		wait(0.01)
		
	end
	
until false
The part of the script that Is causing the problem
t = game.Workspace["Game time stuff"].Time.Value
			script.Parent.Text = "Time till day: "..t
			wait(0.01)
			
			if game.Workspace["Game time stuff"].Time.Value == 10 then

				repeat

					script.Parent.TextColor = "Really Red"
					wait(1)
					script.Parent.TextColor = "White"
					wait(1)

				until game.Workspace["Game time stuff"].Time.Value == 1


			end

Video of the problem:
https://gyazo.com/96c4c6cee2979bd13a1ffba65aef74ff

(The timer works/counts down till 11 seconds)

Any suggestions for fixing this problem are heavily appreciated!

Check the output/console, since it stops completely im guessing there has to be some sort of error

I did when but it doesn’t display an error.

Try this:

t = game.Workspace["Game time stuff"].Time.Value
local flashing = false

repeat

	t = game.Workspace["Game time stuff"].Time.Value
	script.Parent.Text = "Intermission: "..t
	wait(0.01)

	if game.Workspace["Game time stuff"].Time.Value == 150 then

		repeat

			t = game.Workspace["Game time stuff"].Time.Value
			script.Parent.Text = "Time till day: "..t
			wait(0.01)

			if game.Workspace["Game time stuff"].Time.Value <= 10 and game.Workspace["Game time stuff"].Time.Value > 1 and not flashing then

				task.spawn(function()
					flashing = true
					
					repeat
						script.Parent.TextColor = BrickColor.new("Really red")
						wait(1)
						script.Parent.TextColor = BrickColor.new("White")
						wait(1)
					until game.Workspace["Game time stuff"].Time.Value == 1
					
					flashing = false
				end)

			end

		until game.Workspace["Game time stuff"].InGame.Value == 1

	else

		t = game.Workspace["Game time stuff"].Time.Value
		script.Parent.Text = "Intermission: "..t
		wait(0.01)

	end

until false
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.