making character rotate correctly with slope?
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
1 | function moveSet:setTilt() |
2 | if self.humanoid:GetState() = = Enum.HumanoidStateType.Running or self.humanoid:GetState() = = Enum.HumanoidStateType.RunningNoPhysics then |
3 | local ray = Ray.new(self.hrp.Position, Vector 3. new( 0 , - 3 , 0 )) |
4 | local FloorPart,pos,normal = workspace:FindPartOnRay(ray, self.character) |
6 | self.root.C 0 = CFrame.new(Vector 3. new( 0 , 0 , 0 ),normal) * CFrame.Angles(math.rad( 0 ), math.rad( 270 ), math.rad( 90 )) |