It always breaks on the third line and I no idea why it does it, I don't know if there is something wrong with Until or the equal signs. If you wonder what this script is, its a floating script.
w = 0 while wait() do repeat until W == 20 script.Parent.Position = script.Parent.Position + Vector3.new(0, 0.1, 0) W = W + 1 print(W) repeat until W == 60 script.Parent.Position = script.Parent.Position + Vector3.new(0, 0.01, 0) W = W + 1 print(W) repeat until W == 40 script.Parent.Position = script.Parent.Position + Vector3.new(0, -0.01, 0) W = W - 1 print(W) repeat until W == 20 script.Parent.Position = script.Parent.Position + Vector3.new(0, -0.1, 0) W = W - 1 print(W) repeat until W == 0 script.Parent.Position = script.Parent.Position + Vector3.new(0, 0.01, 0) W = W - 1 print(W) end
Well, you made a big mistake. If you say "repeat until" you are telling it do nothing until it hits the certain until mark. Here is how you should make your code to fix it
W = 0 while wait() do repeat script.Parent.Position = script.Parent.Position + Vector3.new(0, 0.1, 0) W = W + 1 print(W) wait() until W == 20 repeat script.Parent.Position = script.Parent.Position + Vector3.new(0, 0.01, 0) W = W + 1 print(W) wait() until W == 60 repeat script.Parent.Position = script.Parent.Position + Vector3.new(0, -0.01, 0) W = W - 1 print(W) wait() until W == 40 repeat script.Parent.Position = script.Parent.Position + Vector3.new(0, -0.1, 0) W = W - 1 print(W) wait() until W == 20 repeat script.Parent.Position = script.Parent.Position + Vector3.new(0, 0.01, 0) W = W - 1 print(W) wait() until W == 0 wait() end
This script fixes the breaking. Here is the explanation:
The repeats were breaking for 2 reasons:
They were repeating for nothing They had no wait time, running it at a pace LUA could not handle
Next time, try putting a wait inbetween. Using wait()
will work, because waiting 0 seconds is still a time frame to lua