Problem with setting CFrame

Hello,

I wanted to make ladder placement (cuz I was bored) from STEEP STEPS and everything works good but I have problem with setting ladder CFrame.

How it looks (my version):

How it looks in STEEP STEPS:

It’s looks like, It’s Raycast problem (I think).

Here is code:

local RunService = game:GetService("RunService")

local tool = script.Parent

local part = workspace.Test

tool.Equipped:Connect(function()
	print("Equipped")
	local player = tool.Parent

	if player:FindFirstChildOfClass("Humanoid") then
		local ledderExist = workspace:FindFirstChild(player.Name .. "'s Ledder")

		if ledderExist then
			return -- for now it's just return
		else
			local Template = ReplicatedStorage.Ledder:Clone()
			Template.Parent = workspace
			Template.Name = player.Name .. "'s Temp"

			local RayParams = RaycastParams.new()
			RayParams.FilterDescendantsInstances = {player, Template}
			RayParams.FilterType = Enum.RaycastFilterType.Blacklist

			RunService.Heartbeat:Connect(function()
				local result = workspace:Raycast(player.HumanoidRootPart.Position, Template.Handle.Position - player.HumanoidRootPart.Position, RayParams)

				if result and result.Instance then
					Template.Handle.CFrame = CFrame.new(result.Position) * player.HumanoidRootPart.CFrame.Rotation					
				else
					Template.Handle.CFrame = player.HumanoidRootPart.CFrame * CFrame.new(0,0,-5)
				end
			end)
		end
	end
end)

It looks like its getting pushed into the ground? If so you need to add some offset to where you set the CFrame.