Trying to figure out how I can find the certian face of a part with raycasting

I’m making a wall climbing mechanic, and I need some help trying to figure out what face the wall is so that the player can snap onto a specific offset so that they can get onto the part.

Here is the code

-->> Wall Climbing <<--
local origin = character.PrimaryPart
local direction = origin.CFrame *, 0, -1)
local params =

local rayPart ="Part")
rayPart.Name = character.Name.." Ray Part"
rayPart.Anchored = true
rayPart.Material = Enum.Material.SmoothPlastic
rayPart.CanCollide = false
rayPart.Parent = workspace.Terrain
rayPart.Size =, 1, 2)

params.FilterDescendantsInstances = {character, rayPart}
params.FilterType = Enum.RaycastFilterType.Blacklist
params.IgnoreWater = true

while task.wait() do
	rayPart.CFrame = direction

	local origin = character.PrimaryPart.CFrame
	local direction = origin *, 0, -2)
	rayPart.CFrame = direction *, 0, 1)
	local raycastResult = workspace:Raycast(origin.Position, direction.Position - origin.Position, params)

	if raycastResult then
		if raycastResult.Instance.Name == "ClimableWall" then
			character.PrimaryPart.CFrame =
1 Like

You can use the normal which is a direction vector that you can return from raycasting, and then align your character to that

1 Like

Ok so, I’ve began printing out the normal, and its been giving me the values, but how would I figure out the position from just this?

1 Like