Turn snowboard 90 degrees

Im trying to turn this snowboard around so its horizontal.

Ive tried bodygyro by multipluing the humanoid root part cframe by an angle, but that means that if the player is not going straight down, the board will not end up horizontal and will overshoot or undershoot.

Im looking fr a reliable way of getting the board horizontal relative to the mountain or hill, and having this work for any orientation the land is at.

lol okkkk

Here’s something that might somewhat work.

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local board = -- the board (this code assumes it's part, if it's a model, this should be its primary part)

local player = Players.LocalPlayer -- if this is a server script, this needs to be changed

local rayParams = RaycastParams.new()
rayParams.FilterType = Enum.RaycastFilterType.BlackList


local function calculateCf(oldCf, yOffset, surfacePos, normal)
	local oldUpVec = oldCf.UpVector
	local oldRot = oldCf-oldCf.Position
	local newPos = surfacePos+normal*yOffset
	local dot = oldUpVec:Dot(normal)
	if dot > 1-1e-5 then
		return oldRot+newPos
	end
	if dot < -1+1e-5 then
		return CFrame.Angles(math.pi, 0, 0)*oldRot+newPos
	end
	local scalarAngle = math.acos(dot)
	local rotationAxis = oldUpVec:Cross(normal).Unit
	return CFrame.fromAxisAngle(rotationAxis, scalarAngle)*oldRot+newPos
end

local function updateBoardCf()
	local halfYSize = board.Size.Y/2
	local origin = board.Position
	local dir = -board.CFrame.UpVector*(halfYSize+.1)
	rayParams.FilterDescendantsInstances = {plr.Character}
	local rayResult = workspace:Raycast(origin, direction, rayParams)
	
	if rayResult then
		board.CFrame = calculateCf(board.CFrame, halfYSize, rayResult.Position, rayResult.Normal) -- maybe instead set the bodygyro's CFrame for smoother rotation
	end
end

RunService.RenderStepped:Connect(updateBoardCf)