Magnitude isn't working

  1. What do you want to achieve? I’d like the object to stop falling and teleport to the destination when it reaches a position

  2. What is the issue? Nothing happens

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub? I searched the developer hub and also when I tried printing the magnitude value it was staying the same mostly??

local bulletConnection = nil
bulletConnection = game:GetService('RunService').Heartbeat:Connect(function(deltaTime)
		local position,nextPosition = primary.Position, primary.CFrame.LookVector * deltaTime * speed
		print((nextPosition - teleportzone))
		if (nextPosition - teleportzone).Magnitude <= 20 then
			primary.Position = pos
			bulletConnection:Disconnect()
			bulletConnection = nil
		else
			primary.Position = position + nextPosition
		end
		iterations -= 1
		if iterations == 0 then
			bulletConnection:Disconnect()
			bulletConnection = nil
			model:Destroy()
		end
	end)

It likely has nothing to do with this particular script. How do you get nextPosition and teleportzone?

I’m not sure what teleportzone is referring to, but lookVector is a normalized direction, not a position.

So if you’re comparing a direction to a position, you’re gonna get some pretty inaccurate results.

“teleportzone” isn’t declared in the code which you provided.

hey guys sorry for keeping this topic up, i scrapped the idea and did a different thing