Custom Shift Lock Causing Player to Slide

I’m trying to recreate shift lock, and it seems like pivoting the pivoting the character directly causes it to slide on the ground. So far all the information I’ve found seems to be about custom rigs, I’m using the base r6 rig.

This is the code I’m using.

if not shiftLockEnabled then human.AutoRotate = true return end

	human.AutoRotate = false

	local hPos = hrp.Position
	local x,y,z = camera.CFrame:ToOrientation()
	local shiftCF = CFrame.new(hPos) * CFrame.Angles(0,y,0) * CFrame.new(0,1.5,0)

	char:PivotTo(shiftCF)
2 Likes

I had this issue in my game. Its a really easy fix. Set the humanoidrootparts cframe, dont do PivotTo.

Hrp.Cframe = Cf.new(Hrp.Position, lookDirectionPosition)

1 Like

Didn’t expect that to work due to it breaking characters in the past, but that worked.

2 Likes

Hah this post was anticlimatic. Youre welcome :pray:

2 Likes

Oh yeah another bug will arise with my solution. Make sure your loop for the camera or whatever is in renderstepped.
Also another bug, do not lerp the humanoid cframe

Thesd are both grave errors i spent minutes trying to fix. Minutes i could’ve spent hitting legs or going outside

2 Likes

Alright, thanks for the info :+1:

2 Likes

Found an easier solution than all of this:

UserSettings().GameSettings.RotationType = shiftLockEnabled and Enum.RotationType.CameraRelative or Enum.RotationType.MovementRelative

Not sure if it’s deprecated or not though.
Either way it works, and fulfills the same purpose while keeping truss physics working.

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