And to answer your question, you can refer to the Y position of Vector3s through its Y property:
while true do
game.Workspace.Pup.Position = game.Workspace.Pup.Position + Vector3.new(0,2,0)
task.wait(2)
if game.Workspace.Pup.Position.Y < 20 then
else
break
end
end
You can acquire the Y-axis through this: Vector3.Y
Do not misuse the while loops. They work like if statements with breaks if the statement is not matched. Utilizing the while loop’s functionality will avoid the usage of break.
…thus:
while game.Workspace.Pup.Position.Y >= 20 then
-- your code here
end