So basically, I was making a Wall Climbing system in the steps of this post: Making a "Wall Climbing" System - #6 by Stealthied
It all went well so far until I was free falling before I pressed C to climb, which resulted in the body gyro shifting into the wrong orientation.
https://gyazo.com/70e259f59b66c3a7aee28c9b4d6d5e7e
One of the solutions I have tried consist of this:
Here is the code provided:
function OnClimb()
local Origin, Direction = RootPart.Position, RootPart.CFrame.LookVector
local RaycastResult = workspace:Raycast(Origin, Direction)
if RaycastResult then
Climbing = true
Climbing_Animation:Play()
Climbing_Animation:AdjustSpeed(0)
BodyVelocity.Velocity = Vector3.new(RaycastResult.Position, RaycastResult.Position + RaycastResult.Normal)
BodyGyro.CFrame = CFrame.lookAt(RootPart.Position, RaycastResult.Position)
BodyVelocity.Parent = RootPart
BodyGyro.Parent = RootPart
Humanoid.PlatformStand = true
Humanoid.AutoRotate = false
repeat
RunService.RenderStepped:Wait()
if RootPart.Position.Y > RaycastResult.Instance.Size.Y + 3 then
OffClimb()
end
until (not Climbing)
end
end