R6 character matching the part its standing on's normal

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

as in the title im trying to make the r6 character match the part its standing on’s normal
(using raycasting)
by preferably setting the RootJoints C1 or C0 cframe

for example:

instead of this:
image_2024-11-29_144944632

the character would rotate like this:

image_2024-11-29_145021411

  1. What is the issue? Include screenshots / videos if possible!

ive tried looking across the dev forum, but ive only found one that works in r15, and i tried adapting it to work with r6, but it always had some weird rotation issues (and i lost the post and script)

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

1 Like

you could try using an alignorientation to constantly put the rig at an orientation relative to an attachment below it

wouldnt that also affect the turning of the player? (like rotation left and right/looking around)

also this is my script so far:

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:FindFirstChildOfClass("Humanoid")
local hrp = hum.RootPart
local attMatch = Instance.new("Attachment",hrp)
local runservice = game:GetService("RunService")


runservice.Heartbeat:Connect(function()
	local Info = RaycastParams.new()
	Info.FilterType = Enum.RaycastFilterType.Exclude
	Info.RespectCanCollide = true
	Info.FilterDescendantsInstances = {char}
	local ray = workspace:Raycast(hrp.Position,Vector3.new(0,-5,0),Info)
	
	if ray then
		local normal = ray.Normal
		print(normal)
		attMatch.WorldCFrame = CFrame.new(hrp.Position,hrp.Position+normal)
	end
	
end)