More Accurate Mouse Projectile

I’m trying to achieve an accurate projectile that shoot’s toward your mouse. There’s no problem with the script but it doesn’t work how I want it to.

My Game:

External Media

More Or Less Of What I’m Going For:

External Media

I’ve tried many things but I seems I can’t get it right!

Script:

--// My Projectile Script

--// The othervalue variable is apart of an event, and othervalue stands for the player's mouse.

local Nail = game.ReplicatedStorage.Effects.TuskNail:Clone()
Nail.Parent = workspace
Nail:SetNetworkOwner(nil) --// Set The Network Owner To The Server.
		
Nail.CFrame = plr.Character.HumanoidRootPart.CFrame
		
local BV = Instance.new("BodyVelocity")
BV.Parent = Nail
BV.P = 100000000
BV.MaxForce = Vector3.new(1,1,1) * 10000000
BV.Velocity = (OtherValue).LookVector * 150
		
game.Debris:AddItem(Nail,2)

If anyone could help that would be great.

Try replacing

BV.Velocity = (OtherValue).LookVector * 150

with

BV.Velocity = (OtherValue).Hit.Position - plr.Character.HumanoidRootPart.Position

Side note: (OtherValue) is the players mouse correct?

1 Like

Yes, othervalue is the mouse’s cframe. I’ll test that right now.

This is working a lot better now! lastly is there any way to ramp up the speed? 2020-11-06 18-35-35

Multiplying it should speed it up

2 Likes
BV.Velocity = (OtherValue).Hit.Position - plr.Character.HumanoidRootPart.Position

Multiply the above by whatever you want to scale up the velocity… example:

BV.Velocity = ((OtherValue).Hit.Position - plr.Character.HumanoidRootPart.Position) * 10 -- Multiplies the velocity vector by 10
2 Likes