cframe = script.Parent.Parent.Door.CFrame
function onClick()
for i = 1, 60 do
cframe = cframe + Vector3.new(0.1, 0, 0)
print("loop loop")
wait()
end
wait(5)
for i = 1, 60 do
cframe = cframe - Vector3.new(0.1, 0, 0)
print("looop")
wait()
end
print("done")
end
script.Parent.ClickDetector.MouseClick:connect(onClick)
This script should make a brick move once a button is clicked, wait a few seconds, then move the brick back to its original place. This script runs in the button, and the button and the brick are in a model together. However, the script fails to move the brick anywhere, and yet it prints the strings in output. Why is the script skipping that part of the loop?

1 comment
Thanks!