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.
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:
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)