-
What do you want to achieve? I’d like the object to stop falling and teleport to the destination when it reaches a position
-
What is the issue? Nothing happens
-
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)