Isn’t valid syntax - the interpretter thinks your until is for closing the while, as wait doesn’t create a new scope. If you want to wait for a property to reach a given value, you need to check it whenever it changes.
--Define a function that handles what to do whenever the position is changed.
local onPositionChanged = function()
if platform.Position == endPos then
BP.Position = endPos
elseif platform.Position == startPos then
BP.Position = startPos
end
end
--Run the function whenever the position of the platform changes.
platform:GetPropertyChangedSignal("Position"):Connect(onPositionChanged)
As an aside, you can create a “wait until” if you have an event which fires whenever your condition is met, like this:
Event.Wait()
Though for your case there isn’t an event you can use for this, so you’ll need to use the method above.