- First you should get the position of the mouse in the 3D space on client using Player:GetMouse().Hit.Position
- Use a remote event to send over that position
- Get the direction on the server.
(MousePos - plr.Character.PrimaryPart.Position).unit
- Clone the projectile and spawn it where ever you it to be thrown from.
- Get the distance between the mouse position and the projectile.
(projectile.Position - MousePos).Magnitude
- Change the direction variable so we can calculate the arc shape.
direction = (MousePos - projectile.Position).Unit
direction = Vector3.new(direction .X, 0, direction .Z)
- Calculate the velocity for the arc.
velocity = math.sqrt(distance * workspace.Gravity) * (direction + Vector3.new(0,0.5,0)).Unit
- Lastly give the projectile that velocity.
projectile.AssemblyLinearVelocity = velocity
3 Likes