Repeat until loop not reading boolean value

I made a loop that repeats until a boolean value is found true. But for some reason when the value is found true, it stays looped and doesn’t continue the script, why? (This isn’t the first repeat until loop I have in the game, and I have others exactly like that one and it works fine, so i’m not sure why it decided to break here.)

1 Like

Why are you using repeat wait loops? This can cause lag and is inefficient. You can simply run a .Changed event to check if its true, then run other code if so. Like this:

Nightmare.Changed:Connect(function()
if Nightmare.Value == true then
             -- what you want to run when the value returns true
       end
end)
1 Like

First off, please put a better description in your title so we know what you are trying to fix, since for some reason people posting in the Scripting Support forum seem to like the title ‘Why isn’t this working’ or ‘Why doesn’t my script work’.
Is Nightmare actually a bool value?

1 Like

Okay, I changed it to a changed function but it still doesn’t work.

Okay, I fixed it.
And yeah, nightmare is a boolean value inside a folder in replicated storage, I put a screen shot of it above.

1 Like


wait a minute…is that… zoom and enhance!

I see your issue!

You are setting the value to true from the client then checking for if it’s true on the server. What you need to do is set up a remote event or move your client-sided code to the server.

(For future reference - Green = server, blue = client)

3 Likes

Further adding on to what @SSSpencer413, changes on the client won’t be seen by the server. Always be sure to check where you are scripting such events. And you can use Remotes to communicate between the Client and the Server.

Thank you! I completely forgot about client and server