How to make projectile go to mouse position? (Body velocity)

Does anybody know how I could make a projectile go to my mouses position using body velocity?

3 Likes

So, I’m guessing you know how to script good enough for this, but here’s the method:

You make a local script with a .Activated function (use mouse.Button1Down if you want it to detect the mouse button 1 clicked down), then make a remote event that goes to the server sending their mouse’s position by sending the mouse.Hit.p.

To make the body velocity, you do this:

local pushForce = Instance.new("BodyVelocity",part)
pushForce.MaxForce = Vector3.new(1000000,1000000,1000000)
local directionVector = (mousePos - part.Position).Unit
local velocity = directionVector * 250
pushForce.Velocity = velocity

game.Debris:AddItem(pushForce,0.4)
6 Likes

maybe this video might help

it does not use a bodyvelocity

bodyvelocity was replaced with LinearVelocity

also AlignPosition might even be a option that suits your needs more

3 Likes