Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[SOLVED]How to set a maximum distance for a BodyPosition?

Asked by
soutpansa 120
4 years ago
Edited 4 years ago

I have a script that uses BodyPosition to bring the player to their mouse's position. I'd like to set a max distance to it so that players cant just fly out of the map with it.

Example of what I have :

local BP = Instance.new("BodyPosition")
BP.D = 500
BP.P = 3000
BP.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
BP.Position = mouse.p

I'd like to modify that so they can't go too far.

Thanks for reading

EDIT: Solved it using magnitude

Answer this question