How can i check when a PrismaticConstraint finished moving?

So i don’t think it is possible to solve my problem by checking when a PrismaticConstraint finished moving (because i don’t think it’s possible), but i want to do a smooth part moving (like a tween, but with PrismaticConstraint ). Also if you have a better idea than using a “while true do” loop, feel free to tell it to me!

while true do
				
				spawn(function()
					--task.wait(5) ?
					game.Workspace:WaitForChild("Parts"):WaitForChild("PartConstrain"):FindFirstChild("PrismaticConstraint").TargetPosition = 80
					--task.wait(5) ?
					game.Workspace:WaitForChild("Parts"):WaitForChild("PartConstrain"):FindFirstChild("PrismaticConstraint").TargetPosition = 0
					--task.wait(5) ?
				end)
end

image

P.S. I put a spawn(function() because there are other things in the loop

i’ve solved in this way, but is there an easier way avoiding many loops since i also have to include more constraints like this?

spawn(function()
	while true do
			--print(PrismaticConstraint.CurrentPosition )
			if PrismaticConstraint.TargetPosition == 0 then -- switches the TargePosition back and forth
				PrismaticConstraint.TargetPosition = 80
			else
			PrismaticConstraint.TargetPosition = 0
			end
			task.wait(4)
			end
end)

	while true do

--A LONG CODE
		end