HumanoidRootPart rotation buggy

Hello! I have a script to make the character’s humanoidRootPart rotate relative to the camera’s rotation. However, it barely works without shift lock (it works very consistently in shiftlock though). Here’s a video:
robloxapp-20240908-1236494.wmv (2.4 MB)
As you can see, it works the first time and then stops working completely. When I turn on shift lock, it works very consistently.

Here’s the code:

for i = 30, 0, -1 do
			local results = checker.dashcheck(char)
				if i >= 10 then
					remote:FireServer("after")
					
				end
			if results then
				sidedashing = true
				hum.JumpPower = 0
				hum.WalkSpeed = 0
				print("yeh")
					char.HumanoidRootPart.CFrame = CFrame.lookAt(char.HumanoidRootPart.Position,Vector3.new(workspace.CurrentCamera.CFrame.Position.X, 0 , workspace.CurrentCamera.CFrame.Position.Z) * -1)
				lv.VectorVelocity = workspace.CurrentCamera.CFrame.RightVector  * i * 3
			else
				sidedashing = false
				if lv then
					lv.VectorVelocity = Vector3.new(0,0,0)

				end
			end
			task.wait()
		end

Thank you in advance!

try disable your smooth shift lock script

It’s not enabled though? Also I tried this and it didnt work

Your CFrame rotation is wrong. Just use lookAlong:

char.HumanoidRootPart.CFrame = CFrame.lookAlong(char.HumanoidRootPart.Position, workspace.CurrentCamera.CFrame.LookVector * Vector3.new(1, 0, 1))
1 Like

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