How do i teleport a part after it hits a different part?

I’ve tried multiple things to do this. Basically I want to make it so if you know a ball off the map it teleports back to its original spot.

To where it originally spawned or where it was before it fell?

You can perform checks on the positional magnitude to see if the ball has reached a point that is too far from the point you want it be.

For example:

local DISTANCE_TO_REPOSITION  = 30

local DistanceFromOrigin = (Ball.Position - Origin.Position).magnitude

if DistanceFromOrigin >= DISTANCE_TO_REPOSITION then
-- reposition ball
end

This might work

function OnTouch(hit)
	script.Parent.Position = Vector3.new(InsertPosition)
end
script.Parent.Touched:Connect(OnTouch)

This is more practical than a touch part because if your ball somehow is flung too far past the touch part and it then falls too far, it will be destroyed and will not be repositioned. Using magnitude to get an accurate answer whether or not it has gone too far from your origin, is more reliable I would argue.

1 Like

A fair solution however, this would certainly be a good safeguard in certain circumstances! :slight_smile:

1 Like