I’m trying to figure out how to keep a player upright whilst facing a wall. I have a ray casted out to detect if there’s a part in front of the player, then the humanoid’s platform stand is set to true, then body gyro is inserted and from there sometimes there’s a tilt in the player(look in the image below). I’m trying to figure out how to remove the tilt and just keep the player upright. It’s a really big issue and the player NEEDS to be upright or else the player will slowly move backwards or in whichever direction.
Thanks to anyone who can help me out!
Code:
`local ray = Ray.new(Base.CFrame.p,Base.CFrame.lookVector*.8)
local hit,pos = workspace:FindPartOnRay(ray,character)
if hit then
humanoid.PlatformStand = true
local bodyGyro = Instance.new("BodyGyro")
bodyGyro.CFrame = Base.CFrame
local bodyVelo = Instance.new("BodyVelocity")
bodyVelo.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
wallClimbVariables.bodygyro = bodyGyro
wallClimbVariables.bodyvelo = bodyVelo
bodyVelo.Parent = Base
bodyGyro.Parent = Base
end`
Images:
https://gyazo.com/d128742bd8b18af7f8215529855902b4
(note that the player rotating to the side is NOT a bug, it’s just the player moves away from the wall and is facing away from it whilst walking up to it.)