In my flood script a part goes towards land like a flood but it doesn't stop when I want it to. It does all the other things, but the loop doesn't stop. What is the problem I am having?
Code:
local flood = game.ReplicatedStorage.Values.Flood
local stop = false
flood.Changed:Connect(function()
script.Parent.Transparency = 0.3
if flood.Value == false then
stop = true
end
repeat --This loop doesn't stop
script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,0,-1)
wait(0.01)
until stop == true
stop = false
script.Parent.Position = Vector3.new(-926.5, -21.25, 483.375)
script.Parent.Size = Vector3.new(339.5, 9, 616.25)
script.Parent.Transparency = 0
end)
Thanks!

1 comment
I don't want it to stop at a certain CFrame because sometime flood goes more distance and sometime less distance.