I need help with calculating the distance between mousehitpos and character's pos. I'm doing a script where I want to teleport the player to their mousehit location and I also want to add a limiter to the distance they can teleport. But I can't seem to calculate distance between the player and the character pls help!
✓ ANSWER ACCEPTED
How do i calculate distance between mouse.Hit.Position and char.PrimaryPart.Position?
1 answer
✓ Accepted answer
Vector3 objects have a magnitude property which is basicly the vector length.
Using this you are able to get the distance between mouse and character.
(mouse.Hit.Position - character.HumanoidRootPart.Position).Magnitude
Accept if helps.
This discussion is preserved as it was. New answers, comments, and votes are closed.

5 comments
:0
Can you please accept. If I helped yah.
yeah I will but I'll ask another question how can I like prevent the player from renaming textboxes
K. Ask that and accept this. I need 25 reputation to upvote my friend.
ok