I want to fix mantling on slopes
here’s the issue:
here’s my code:
if not var.wallhang then
local cast2 = workspace:Raycast(hrp.Position+Vector3.new(0,3,0),hrp.CFrame.LookVector*2,plrBl())
if cast2 then
man = cast2
end
var.wallhang = true
--print("Wallhang")
local holdingSpace = var.space
local p = man.Instance
local rotation = CFrame.lookAt(Vector3.zero,-normal)
local ogCFrame = CFrame.new(hrp.Position)*rotation
bg.MaxTorque = Vector3.one*times
bg.D = 0
--bg.P = times
bp.D = 10
bp.P = 50
bg.CFrame = ogCFrame
local oldPos = Vector3.new(ogCFrame.p.X,p.Position.Y+(p.Size.Y/2)-1.5,ogCFrame.p.Z)
bp.Position = oldPos
anims.mantle:Play()
anims.wallclimb:Stop()
stopJumpAnims()
stopVaultAnims()
playSFX("Mantle")
local t = tick()
repeat
stopJumpAnims()
local dt = runService.RenderStepped:Wait()
hrp.CFrame = hrp.CFrame:lerp(CFrame.new(hrp.Position) * rotation,5*dt)
bp.MaxForce = Vector3.one*times
until t+.25 <= tick()
local t = tick()
--print(man.Distance)
bp.Position = oldPos + (ogCFrame.LookVector*(man.Distance+3)) + Vector3.new(0,6.5,0)
repeat
local dt = runService.RenderStepped:Wait()
bp.MaxForce = Vector3.one*times
until t+.25 <= tick()
anims.mantle:Stop()
bg.MaxTorque = Vector3.zero
bp.MaxForce = Vector3.zero
var.wallhang = false
end