I've been working on a script that makes a brick move downward. Instead of making it move until it's Y position is in a specific spot, I wanted it to stop when it touches another brick.
So far I have:
repeat
moonHold.CFrame = CFrame.new(moonHold.Position.X,moonHold.Position.Y-1, moonHold.Position.Z)
--print(moonHold.Position.Y) (testing purposes)
wait()
until moonHold.Touched:connect(function(Part)
if Part.Name ~= "Moon" then
debounce = true
end
end)
And the Until block is the problem, yet I have no idea what to do there. I tried using a Boolean in order to activate the second block of code but that doesn't loop the brick like I wanted it to. I also tried to paste in the code into the if statement but that didn't work either (Unless I did something wrong.)
Any help?

3 comments
Hope it helped!
The thing is, i want it to be in one consecutive script, meaning I'd want the movement to to be in a "repeat until ___" all together.
Okay... Have 1 script and a bool value. Remove the code after repeat(Your Script) and remove while wait() do(My Script), and paste the rest of my 2nd script to your script after the repeat. And then remove after Until(Your Script) and paste my 1st script in after (Your Script) until.