How can I teleport a player to the edge of a part during a ledge climb

I’m wondering how i can make it so that the player teleports to the edge of the part hit by the raycast (so that it looks like the player is holding onto the ledge with his hands). Thought long and hard and couldn’t come up with anything, nor could i find anything that answers my question.

Appreciate any feedback on my code too, since i’m an amateur scripter.

Here it is.

local uis = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local h = character:WaitForChild("Humanoid")
local hrp = character:WaitForChild("HumanoidRootPart")
local torso = player.Character:WaitForChild("Torso")
local head = player.Character:WaitForChild("Head")
local holding = false

local lh = script:WaitForChild("ledgehang")
local hangtrack = h.Animator:LoadAnimation(lh)
hangtrack.Priority = Enum.AnimationPriority.Action
hangtrack.Looped = false

--local lc = script:WaitForChild("ledgeclimb")
--local climbtrack = h.Animator:LoadAnimation(lc)

local function ledgeclimb()
	local torsoRay = Ray.new(torso.Position, torso.CFrame.lookVector * 5)
	local headRay = Ray.new(head.Position + Vector3.new(0,3,0), torso.CFrame.lookVector * 6)
	local torsoPart = workspace:FindPartOnRay(torsoRay, player.Character, false, true)
	local headPart = workspace:FindPartOnRay(headRay, player.Character, false, true)
	
	
	
	if holding == true then
		holding = false
		local vel = Instance.new("BodyVelocity")
		vel.Parent = hrp
		hrp.Anchored = false
		vel.MaxForce = Vector3.new(1,1,1) * math.huge
		vel.Velocity = hrp.CFrame.LookVector * 1 + Vector3.new(0,30,0)
	
		game.Debris:AddItem(vel, .15)
		

	
	
	
	elseif holding == false and torsoPart and not headPart and h.FloorMaterial == Enum.Material.Air then --add a velocity condition
		holding = true
		hangtrack:Play(0, 5)
		hrp.Anchored = true
		
		
	end
	
	

	
end

uis.JumpRequest:Connect(ledgeclimb)