Mouse.Hit leading to a dumbfoundingly incorrect position

No matter where i point my mouse, the projectile i am attempting to shoot always heads in this general direction.
image
Whenever i print out the Mouse.Hit.LookVector, it is never the same, but only mildly different.
image
Here is my code (ignore the comments, i was previously using bodyvelocity)

print(pos)
	paintball.CFrame = CFrame.lookAt(shootpart.Position,pos)
	--paintvel.Parent = paintball
	--paintvel.Velocity = pos.LookVector * 100
	--game.Debris:AddItem(paintvel,10)
	task.spawn(function() -- movement
		for count = 100,0,-1 do
			wait(0.1)
			if expired == false then
			paintball.CFrame += paintball.CFrame.LookVector * 5
			end
		end
	end)

“pos”, in this case, is the Mouse.Hit.LookVector being fired from the client and being assigned to the pos variable in a remove event.
I’ve struggled with projectiles beforehand, but this is a new issue to me.

I apologize if this is not coherent, or enough context, i can share more code if needs be (but this is arguably all that is relevant).

Can you please show me the entire code or atleast most of it so I can understand what is happening more?

I am unsure what else to provide, but i will provide as much as i can.

function shoot()
	local expired = false
	wait(0.5)
	ammo.Value -= 1
	handle.shoot:Play()
	local paintball = Instance.new("Part")
	--local paintvel = Instance.new("BodyVelocity")
	paintball.Shape = Enum.PartType.Ball
	paintball.BrickColor = BrickColor.Random()
	paintball.Size = Vector3.new(0.5,0.5,0.5)
	paintball.Parent = workspace
	paintball.Anchored = true
	--paintball.CFrame = shootpart.Position
	print(pos)
	paintball.CFrame = CFrame.lookAt(shootpart.Position,pos)
	--paintvel.Parent = paintball
	--paintvel.Velocity = pos.LookVector * 100
	--game.Debris:AddItem(paintvel,10)
	task.spawn(function() -- movement
		for count = 100,0,-1 do
			wait(0.1)
			if expired == false then
			paintball.CFrame += paintball.CFrame.LookVector * 5
			end
		end
	end)
	game.Debris:AddItem(paintball,10)

This is essentially the entire shooting function, except for the part where the projectile makes contact with a surface (It is separate, and is working fine)

The code below is the entire function in the LocalScript of the tool that i am using, as you can see i am transferring the Hit.Lookvector correctly through a remoteevent.

tool.Activated:Connect(function()
	if not gunshootanim then gunshootanim = tool.Parent.Humanoid.Animator:LoadAnimation(gunshoot) end
	if shootdb == false and ammo.Value > 0 then
	task.spawn(function()
		shootdb = true
		wait(gunshootanim.Length)
		shootdb = false
	end)
	gunshootanim:AdjustSpeed(1.5)
	gunshootanim.Priority = Enum.AnimationPriority.Action4
	gunshootanim:Play()
	ev:FireServer(mouse.Hit.LookVector) 
	end
end)

I can provide more.

I’m still confused where you’re getting “pos” from

This is the nature of :GetMouse(), old, unreliable, inaccurate, you are better off using a custom mouse module that uses raycasts.

“pos” is initially a variable defined at the beginning of my server script, and the mouse part of ev:FireServer(mouse.Hit.LookVector) IS the “pos” itself.
It is recieved on the server script through the “ev” remote event, where pos is set to the mouse’s hit lookvector.

Noted. But is that the only solution?

use Mouse.Origin.LookVector instead

game.Players.LocalPlayer:GetMouse().Position

or

local UserInputService = game:GetService("UserInputService")
local mouseLocation = UserInputService:GetMouseLocation()

local camera = workspace.CurrentCamera
local mousePos = camera:ScreenPointToRay(mouseLocation.X, mouseLocation.Y)

-- raycast