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