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

Repeat until keep's crashing studio?

I am trying to make this work until the BoolValue's value is changed to false, but it keep's crashing my studio even with a wait. Can someone tell me how to fix it?

Here is the code.

val = script.Parent.on -- BoolVaue
g1 = script.Parent.G1 -- Model

val.Changed:connect(function()
	if val.Value == true then
		repeat until val.Value == false
		wait(0.02)
		for _,v in pairs(g1:GetChildren()) do
			if v.Name == "Light" then
				v.Point.Enabled = true
				v.Lighto.Enabled = true
				wait(0.02)
				v.Point.Enabled = false
				v.Lighto.Enabled = false
				wait(0.02)
			end
		end
	end
end)

1 answer

✓ Accepted answer

Repeat until loops take the following structure:

--[[
repeat
[chunk]
until condition
]]

On line 6, you create a repeat until loop, with no chunk. In other words, you didn't put a wait time for the loop.

To fix, do the following:

repeat wait() until val.Value == false

2 comments

0

Thanks.

0

Yup

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