Teleporting a player in a certain radius

I wanna make a player teleport to their mouse thing is I don’t want them going to far so I did a magnitude check. How would I bring the current magnitude to 20 and only teleport them 20 studs?

1 Like

hrp.Position + (point - hrp.Position).Unit * 20

Where point is the target position and hrp is HumanoidRootPart. Basically just getting the direction vector and multiplying it by the distance.

2 Likes

I would’ve never thought of that thanks

1 Like