Neeed help With a Position

So i am using repeat and i want to know how to check when a part has hit a certain position then it stops going up.

Presuming the script is inside the part in question.

local part = script.Parent
local end_part ='Part')
end_part.Name = "end_part"
end_part.Position =,100,00)
end_part.Anchored = true
end_part.Parent = workspace

part.Position =,0,0)

	part.Position +=,1,0)
until part.Position ~= end_part.Position

haven’t tested it out though

repeat task.wait() until part.CFrame =="Your CFrame")

It still keeps going up, also that ~= made it not even go up

You should just check the Y component, and use >= to make the comparison work with slight inaccuracies.

  part.Position +=, 1, 0)
until part.Position.Y >= 100

However, you probably don’t actually want to do this. If you’re just trying to make a part go up to a certain height, you can tween it directly to that height:

local part = workspace.Part
local tweenService = game:GetService("TweenService")
local tweenInfo = -- takes three seconds
local moveUp = 20 -- studs
local targetPosition = part.Position +, moveUp, 0)
local tween = tweenService:Create(part, tweenInfo, { Position = targetPosition })

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.