Problem with raycast

I’m trying to make a gun and for some reason the Raycast direction is above the mouse.
image
I have no idea whats going on. I’ve tried messing with values and other stuff but no avail.

code:

local Mouse = List.Mouse
	local Origin = List.Origin
	local Direction = (Mouse - Origin).Unit
	local Distance = (Mouse - Origin).Magnitude
	if Distance > List.MaxDist then
		Distance = List.MaxDist
	end
	local Raycast = Ray.new(Origin, Direction * Distance)
	local marker = List.Projectile:Clone()
	marker.Parent = workspace.Debris
	marker.Position = Direction * Distance

Issue found. the output was an attachment and I used cframe instead of world cframe

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.