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)
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