Incorrect closing end issue

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

  1. I want my script to work. It should work, But it doesn’t.

  2. I am getting an error: Syntax error: Expected 'end' (to close 'then' at line 2) got 'until'.

  3. I have not tried much yet.

Here is my script:

while true do
	if workspace.RealTemp.Value > 17499 then
		game.ReplicatedStorage.AG:FireAllClients("Warning: Reactor teprature is reaching critical levels!", 5, Color3.fromRGB(255, 255, 0))
		until workspace.RealTemp.Value > 19999 or workspace.RealTemp.Value
		wait(0.1)
		end
		if workspace.RealTemp.Value > 19999 then
			game.ReplicatedStorage.AG:FireAllClients("DANGER: Reactor temprature has reached critical levels! Prepare for reactor meltdown!", 5, Color3.fromRGB(255, 0, 0))
		end
	end
end

The ‘until’ seems to be causing the problem. Is there any other way to wait until a condition? That may fix the problem.

An “until” needs to be matched with a “repeat” statement. I would write this instead:
repeat wait() until workspace.RealTemp.Value > 19999

However, your script has other problems. If the temperature is above 19999, then the clients will be spammed with a remote event. I would add this to the end of the loop:
repeat wait() until workspace.RealTemp.Value < 19999 and RealTemp.Value > 17499

You also have an extra end statement and your indentation is off

Thanks! Testing it now. I need to make it spicy burrito

Edit: Now I’m getting something about “Exhausted execution time”… Can someone help?

Okay, I fixed it! Thanks for the help!

Also, repeat until loops don’t need an end (unlike for and while loops).