Fire at look direction instead of mouse location

I’m a new scripter and I recently managed to make a blast script with the help of a tutorial, I understand the script, however, I don’t know how to change it to do exactly what I want, which is to fire in the direction the player is facing instead of firing at the position of the mouse like its currently doing

local PPosition = RHand.Position + CFrame.new(RHand.Position,Mouse.p).lookVector * 1
	Part.CFrame = CFrame.new(PPosition, Mouse.p)
	Part:SetNetworkOwner(Player)
	local BV = Instance.new("BodyVelocity" , Part)
	BV.Velocity = Mouse.LookVector * 140
	BV.MaxForce = Vector3.new(1e8,1e8,1e8)
	return
end 

I’ve experimented with it on my own, and then tried to find a potential fix online to no avail

Thank you :slight_smile:

Pretty simple :wink: Just set the Velocity to the HumanoidRootPart’s LookVector instead of the Mouse if you’ve already defined your character:

local HRP = Player.Character:WaitForChild("HumanoidRootPart")
local PPosition = RHand.Position + CFrame.new(RHand.Position,Mouse.p).lookVector * 1
	Part.CFrame = CFrame.new(PPosition, Mouse.p)
	Part:SetNetworkOwner(Player)
	local BV = Instance.new("BodyVelocity" , Part)
	BV.Velocity = HRP.CFrame.LookVector * 140
	BV.MaxForce = Vector3.new(1e8,1e8,1e8)
	return
end
2 Likes