Ray hitting below the cursor position

  1. What do you want to achieve? I want the ray to hit where the mouse is aiming without using mouse.hit because player accessories mess with the hit position.

  2. What is the issue? The ray is hitting below the mouse cursor.

When my weapon fires the ray hits below the mouse cursor for some reason.

	local raycastParams = RaycastParams.new()
	raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
	table.insert(Ignore, game.Players.LocalPlayer.Character)	
	raycastParams.FilterDescendantsInstances = {Ignore}
	local Ray = Mouse.UnitRay
	local Origin, Direction = Tool.Emitter1.Position, Ray.Direction.Unit * Tool.StatInfo.Range.Value
	local RayPath = workspace:Raycast(Origin, Direction, raycastParams)

Remove the Unit from Ray.Direction.Unit

That seems to have improved it if the camera is level with the character, but it appears that the camera position is causing the problem for me. Pistol error

Actually for this you shouldn’t be using UnitRay because according to the documentation here:
UnitRay

It says that Mouse.UnitRay orginates from the Camera CFrame hence why the camera position is affecting the Ray. In conclusion you should stick with Mouse.Hit.p and use Mouse.TargetFilter to ignore the player’s character.

Mouse.TargetFilter