Mouse.hit seems to be very inaccurate when it comes to firing objects at the mouses position. Here is the snippet of my code that deals with firing the object.
As you can see below, I am firing a part at the mouses lookVector, as if I were to aim it at the mouse.hit.position, the attack would fall down on me if i were to fire it straight up
local function fire(object, direct)
if object ~= nil then
local bodyvelocity = Instance.new("BodyVelocity")
bodyvelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
object.CFrame = CFrame.new(object.Position, player:GetMouse().hit.p)
bodyvelocity.Velocity = player:GetMouse().hit.lookVector * 50
object.Anchored = false
bodyvelocity.Parent = object
game:GetService("Debris"):AddItem(object, 3)
end
end
Here is a gif to explain my problem https://gyazo.com/33fdf3e0480206f39475827996972040
^not sure why it keeps blocking it ._.
