Script won't move onto the next line when the Clock time reaches the time in the script

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear! I want to fix my script being stuck on one line.

  2. What is the issue? Include screenshots / videos if possible! The script is only doing one line and not moving onto the next line after the clocktime has changed

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub? I tried debugging this error

Hello so i’m having a problem in the script where it’s getting stuck at a line and ignoring the others. I have already spent attempting to debug this script but i can’t figure out what’s the problem with the script

while true do
	repeat until
	wait(1) 
	 if game.Lighting.ClockTime >= 17.7 then
		print("Checked line 5")
		game.Lighting.GlobalShadows = true
		game.Lighting.OutdoorAmbient = Color3.fromRGB(45,45,45)
		game.Lighting.Ambient = Color3.fromRGB(118,118,118)
		game.Lighting.Brightness = 0
		game.Lighting.FogStart = false
		game.Lighting.FogColor = Color3.new()
		print("on line 10")
	else 
		if game.Lighting.ClockTime > 18.01 then
			print("Checked line 15")
			game.Lighting.GlobalShadows = false
			game.Lighting.OutdoorAmbient = Color3.fromRGB(35,35,35)
			game.Lighting.Ambient = Color3.fromRGB(50,50,50)
			game.Lighting.Brightness = 0
			game.Lighting.FogStart = math.random()
			game.Lighting.FogColor = Color3.new(255,255,255)
		else
			if game.Lighting.ClockTime >= 19.48 then
				print("checked line 24")
				game.Lighting.GlobalShadows = false
				game.Lighting.OutdoorAmbient = Color3.fromRGB(30,30,30)
				game.Lighting.Ambient = Color3.fromRGB(25,25,25)
				game.Lighting.Brightness = 0
				game.Lighting.FogStart = math.random()
				game.Lighting.FogColor = Color3.new(255,255,255)
print("on line 28")
			else
				if game.Lighting.ClockTime >= 21 then
					print("Checked line 34")
					game.Lighting.GlobalShadows = false
					game.Lighting.OutdoorAmbient = Color3.fromRGB(25,25,25)
					game.Lighting.Ambient = Color3.fromRGB(0,0,0)
					game.Lighting.Brightness = 0
					game.Lighting.FogStart = math.random()
					game.Lighting.FogColor = Color3.new(255,255,255)
				else
					if game.Lighting.ClockTime >= 4 then
print("checked line 43")
						game.Lighting.GlobalShadows = false
						game.Lighting.OutdoorAmbient = Color3.fromRGB(35,35,35)
						game.Lighting.Ambient = Color3.fromRGB(5,5,5)
						game.Lighting.Brightness = 0
						game.Lighting.FogStart = math.random()
						game.Lighting.FogColor = Color3.new(255,255,255)
					else 
						if game.Lighting.ClockTime >= 6.07 then
							print("checked line 52")
							game.Lighting.GlobalShadows = false
							game.Lighting.OutdoorAmbient = Color3.fromRGB(40,40,40)
							game.Lighting.Ambient = Color3.fromRGB(10,10,10)
							game.Lighting.Brightness = 1
							game.Lighting.FogStart = false
							game.Lighting.FogColor = Color3.new(255,255,255)
						else 
							if game.Lighting.ClockTime >= 6.3 then
								print("checked line 61")
								game.Lighting.GlobalShadows = false
								game.Lighting.OutdoorAmbient = Color3.fromRGB(45,45,45)
								game.Lighting.Ambient = Color3.fromRGB(15,15,15)
								game.Lighting.Brightness = 1
								game.Lighting.FogStart = false
								game.Lighting.FogColor = Color3.new(255,255,255)
							else
								if game.Lighting.ClockTime >= 9 then
									print("checked line 70")
									game.Lighting.GlobalShadows = false
									game.Lighting.OutdoorAmbient = Color3.fromRGB(65,65,65)
									game.Lighting.Ambient = Color3.fromRGB(148,148,148)
									game.Lighting.Brightness = 2
									game.Lighting.FogStart = false
									game.Lighting.FogColor = Color3.new(255,255,255)
								else
									if game.Lighting.ClockTime >= 12 then
										print("checked line 79")
										game.Lighting.GlobalShadows = true
										game.Lighting.OutdoorAmbient = Color3.fromRGB(70,70,70)
										game.Lighting.Ambient = Color3.fromRGB(155,155,155)
										game.Lighting.Brightness = 2
										game.Lighting.FogStart = false
										game.Lighting.FogColor = Color3.new(255,255,255)
									else 
										
										if game.Lighting.ClockTime >= 15 then
											print("checked line 89")
											game.Lighting.GlobalShadows = true
											game.Lighting.OutdoorAmbient = Color3.fromRGB(80,80,80)
											game.Lighting.Ambient = Color3.fromRGB(165,165,165)
											game.Lighting.Brightness = 3
											game.Lighting.FogStart = false
											game.Lighting.FogColor = Color3.new(255,255,255)
											print("made it to the end all good!")
											
										end
									end
								end
							end
						end
					end

				end
			end
		end

	end
end

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

You see, you’re checking the wrong way

simpler example:

if X>10 then
	--X is bigger than 10
else
	--else X is smaller than 10, thus it'll never be bigger than 20
	if X>20 then
		--impossible

you gotta check in the opposite way, the largest time first

if game.Lighting.ClockTime >= 21 then
	--code
else
	if game.Lighting.ClockTime >= 19.48 then
		--code
	else
		-- ... if smaller time then ...
	end
end