local kontrol = workspace.engeltestkontrol.Position
while lock ~= kontrol.Position do
local lock = workspace.buyukkapi.engel.Position
workspace.buyukkapi.engel.Position = workspace.buyukkapi.engel.Position - Vector3.new(0,0,0.25)
workspace.buyukkapi.disli.ust.Orientation =workspace.buyukkapi.disli.ust.Orientation - Vector3.new(0,0,1)
workspace.buyukkapi.disli.alt.Orientation =workspace.buyukkapi.disli.alt.Orientation + Vector3.new(0,0,1)
wait(0.01)
end
My guess as to the problem is that the positions never do equal one another, either because the underlying math is off or because positions can be unprecise by nature. If you’re just interested in code that works, the following should function granted all the variables/information given are accurate:
repeat
local lock = workspace.buyukkapi.engel.Position
local kontrol = workspace.engeltestkontrol.Position
workspace.buyukkapi.engel.Position = workspace.buyukkapi.engel.Position - Vector3.new(0,0,0.25)
workspace.buyukkapi.disli.ust.Orientation =workspace.buyukkapi.disli.ust.Orientation - Vector3.new(0,0,1)
workspace.buyukkapi.disli.alt.Orientation =workspace.buyukkapi.disli.alt.Orientation + Vector3.new(0,0,1)
wait(0.01)
until (lock-kontrol).Magnitude <= 0.6
Additionally, There’s a few things I’d like to note here:
Firstly, you’re storing the variables before the movement and wait function, so it would always overshoot by at least one loop if it did function correctly. (if elaboration is needed let me know)
You can use the -= and +=Compound Assignment operators as replacements for ust.Orientation = ust.Orientation - Vector3.new(0,0,1) and .alt.Orientation = .alt.Orientation + Vector3.new(0,0,1) respectively. (ex: ust.Orientation += Vector3.new(0,0,1) )
TweenService is a much simpler, and better, way of achieving what you’re wanting; you can look into it at your own convenience.