How do I position a part correctly?

Desired Result:
Screenshot_3

Outcomes
If the pictures don’t load, try clicking on them

This screenshot shows the part rotated from my character’s head, rather than pointing directly in front of it.

This screenshot shows that when on a slightly elevated position, such as a spawn point, the part is rotated upwards rather than pointing forward.

Script

local rayParams = RaycastParams.new()
rayParams.FilterDescendantsInstances = {Player}
local ray = workspace:Raycast(Player.HumanoidRootPart.Position, Player.HumanoidRootPart.CFrame.UpVector * -7, rayParams)
				
if ray then
     local newModel = modelFolder:FindFirstChild("TestModel"):Clone()
     newModel:PivotTo(CFrame.lookAt(ray.Position, Vector3.new(Player.Head.CFrame.LookVector)))
     newModel.Parent = workspace
end

The raycast is for having the part positioned atop whatever instance the ray touches, rather than have it float in the air.

You want to ignore the upwards/downwards rotation of the head, and offset the part in the direction the head is looking by size/2 studs.

Is this how I would ignore the upwards/downwards rotation?

Vector3.new(Player.Head.CFrame.LookVector.X, 0, Player.Head.CFrame.LookVector.Z)

As well, how would I go about offsetting the part? The position is determined by a ray pointing straight down from the HumanoidRootPart. However when I tried to offset it like so:

newModel:PivotTo(CFrame.lookAt(ray.Position + Vector3.new(5, 0, 0), ...)

it caused the part to be rotated like in the 3rd screenshot (upwards/curved)

Just tried this and unfortunately the part still does not orientate towards the character’s direction. Looking for solutions

EDIT: I figured out the orientations on my own. Now just working on how to offset the part

CFrame.LookVector is already Vector3 so please change CFrame.lookAt(ray.Position, Vector3.new(Player.Head.CFrame.LookVector)) to CFrame.lookAt(ray.Position, Player.Head.CFrame.LookVector)

You can offset the part by doing

underneathCharacterCFrame + Lookvector + Size.X/2 -- (or whatever is the long side)

It should move a correctly oriented version of img 2 to the positioning shown in img 1.