so i made this function which should tilt the player to the surface below them, but if you rotate the character it does not rotate it normally, it rotates it in a weird way
function moveSet:setTilt()
if self.humanoid:GetState() == Enum.HumanoidStateType.Running or self.humanoid:GetState() == Enum.HumanoidStateType.RunningNoPhysics then
local ray = Ray.new(self.hrp.Position, Vector3.new(0, -3, 0))
local FloorPart,pos,normal = workspace:FindPartOnRay(ray, self.character)
if FloorPart then
self.root.C0 = CFrame.new(Vector3.new(0,0,0),normal) * CFrame.Angles(math.rad(0), math.rad(270), math.rad(90))
end
end
end

3 comments
is there a error?
no
i dont know how to fix the rotation if the characters rotation isnt a part of motor 6d