BodyPosition doesnt work on slopes

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

Any errors in the output?? I kind of need more information.

It turned out to be that i had made a very weird system, hard to explain what i did wrong and am doing right now but it has something along the lines of adding to the position instead of going to the top

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.