Needing help regarding the raycasting of bullet holes!

local function BulletDecal(Player, Origin, MousePosition)
	local Paramaters = RaycastParams.new()
	Paramaters.FilterDescendantsInstances = {Player.Character}
	Paramaters.FilterType = Enum.RaycastFilterType.Exclude

	local Result = workspace:Raycast(Origin.Position, (MousePosition - Origin.Position).Unit * 5000, Paramaters)

	if Result then
		local Position = Result.Position
		local Hit = Result.Instance
		local Normal = Result.Normal

		local BulletHole = game:GetService("ServerStorage"):WaitForChild("BulletDecal"):Clone()
		BulletHole.Parent = Hit
		
		BulletHole.CFrame = CFrame.new(Position) * CFrame.new(Vector3.new(), Normal):Inverse()

	end
end

Here’s my code, it works on all axis’s (to my knowledge, at least) EXCEPT the top and bottom ones. How can I fix it?

Demonstration:

However:

BulletHole.CFrame = CFrame.lookAlong(Position, Normal)
3 Likes

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