How do I align the player to the slope?

I would like the player’s orientation to align with the slope.

Adding -90 to the lookpart’s X and Y orientation to the player messes up the players orientation

I have tried messing with the lookpart’s X and Z orientations, but to no avail.

This is how the lookPart looks when not on a slope.
(The hinge shows where the front of the lookPart is)

This is how I want the lookPart to face when on a slope.

Instead, it faces 90 degrees to the left on the slope:

If anyone can help, it would be greatly appreciated.

NOTE: This script is made with the Juke's Towers of Hell 5.5 kit in mind.

local ts = game:GetService'TweenService'

return function ()
	local plr = game.Players.LocalPlayer
	local char = plr.Character
	local torso = game.Players.LocalPlayer.Character:FindFirstChild("Torso")
	local attach ="Attachment", torso)
	local vectorf1 ="VectorForce", attach)
	local vectorf2 ="VectorForce", attach)
	attach.Orientation =,0,90)
	vectorf1.Force =,torso.AssemblyMass * workspace.Gravity,0)
	vectorf1.Attachment0 = attach
	vectorf1.RelativeTo = "World"
	vectorf1.Enabled = false
	vectorf1.Name = "GravityCounteract"
	vectorf2.Force =
	vectorf2.Attachment0 = attach
	vectorf2.RelativeTo = "Attachment0"
	vectorf2.Enabled = false
	local params =
	params.FilterType = Enum.RaycastFilterType.Include
	params.FilterDescendantsInstances = {script.Parent}
	local playerholder ="Part", game.Players.LocalPlayer.Character)
	playerholder.Size =
	playerholder.Shape = "Ball"
	playerholder.CFrame = torso.CFrame *, -2.5, 0)
	playerholder.CanCollide = false
	local phWeld ="WeldConstraint", playerholder)
	phWeld.Part0 = playerholder
	phWeld.Part1 = torso
	local lookPart ="Part", game.Players.LocalPlayer.Character)
	lookPart.Anchored = true
	lookPart.CanCollide = false
	lookPart.Size =,2,1)
	lookPart.FrontSurface = "Hinge"
	local ph2 ="Part", char)
	ph2.Size =, 0.4, 3)
	local hrp = game.Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
	local joint = hrp.RootJoint
		local rsLoop = game:GetService'RunService'.RenderStepped:Connect(function()
			local result = workspace:Raycast(torso.Position, torso.CFrame.UpVector * -3, params)
			if result then
				vectorf1.Enabled = true
				vectorf2.Enabled = true
				lookPart.CFrame = CFrame.lookAt(result.Position, result.Position + result.Normal) * CFrame.Angles(math.rad(-90), math.rad(-90), 0)
				vectorf2.Force = -((workspace.Gravity * torso.AssemblyMass) * 2), 0)

I believe this is what you are looking for:

The game is open-sourced, so you can view & use the code as needed! :slight_smile:

I was looking for something similar, but simpler script wise.

I see…

The caveat here is that the design of Rthro characters is explicitly built for upright travel, and to create adaptation to sloped travel requires adjustments to the character controller and the camera for smooth gameplay.

In what ways are you looking for it to be simplified?

the system is supposed to work with r6, and i would only like for it to only affect a folder of parts.

If this is all you are looking to do, I recommend casting a ray against the floor, then calculating the normal using:

local raycastResult = workspace:Raycast(rayOrigin, rayDirection)
local rayNormal = raycastResult.Normal

From here, you can take the cross product with the right vector (right hand rule) to align the parts parallel to the surface normal.

local rayResult = raycastResult.Instance
local parallelOrientation = rayNormal:Cross(rayResult.CFrame.RightVector)