HumanoidRootPart CFrame wont update with RunService

I made a script which is supposed to rotate the humanoid’s root part according to the cameras CFrame, but for some reason it does not update.

Here’s the code:

local function EnableShiftLock(Enabled)
	if Enabled then
		print(Camera.CFrame.LookVector)
		local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
		
		if HumanoidRootPart then
			HumanoidRootPart.CFrame = CFrame.new(HumanoidRootPart.Position, Vector3.new(Camera.CFrame.LookVector.X * 900000, HumanoidRootPart.Position.Y, Camera.CFrame.LookVector.Z * 900000))
		end
		
		Camera.CFrame = Camera.CFrame * CFrame.new(1.7, 0, 0)
	else
		if Active then
			Active:Disconnect()
			Active = nil
		end
	end
end

local function Shiftlock(ActionName, InputState, _inputObject)
	if ActionName == "ShiftLock" and InputState == Enum.UserInputState.Begin then
		if not ShiftEnabled then
			ContextActionService:SetImage("ShiftLock", "rbxassetid://111387717910520")
			
			if not Active then
				Active = RunService.RenderStepped:Connect(function()
					EnableShiftLock(true)
				end)
			end
			
			ShiftEnabled = true
		else
			ContextActionService:SetImage("ShiftLock", "rbxassetid://84773258367355")
			EnableShiftLock(false)
			ShiftEnabled = false
		end
	end
end

Everything work’s fine except the Humanoid Root Part not updating

It works fine when I test myself. There is something wrong with your character.

1 Like

Alright, thanks for the feedback I will check it out.

To clarify: does the script run all of its functions, and the code does nothing, or do the functions not run at all? Because if the enable shift lock function doesn’t run at all, then you have an issue with whatever checks you are doing beforehand.

The issue is that the characters CFrame is not updating, I have tested in a separate place and it seems to work, I believe the issue is that there’s a script that may be interfeering with this one.

1 Like

Try using the FindAll tool to look for any code in any script that changes character cframe.

Yeah I managed to find a script which was interfeering with mine, thank you.

1 Like

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