Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to Stop Humanoid Rotation on script?

Asked by
Jetex_m -5
5 years ago
local cam = game.Workspace.CurrentCamera
local tor = Character.HumanoidRootPart
local hum = Character.Humanoid
local Mouse = Player:GetMouse()
local prev_mousehit

game:GetService("RunService").RenderStepped:Connect(function()
    if (cam.Focus.p-cam.CoordinateFrame.p).magnitude > 1 then
        hum.AutoRotate = false
        if Mouse.Hit.p ~= prev_mousehit then
            tor.CFrame = CFrame.new(tor.Position, Vector3.new(Mouse.Hit.p.x,tor.Position.y,Mouse.Hit.p.z))
            prev_mousehit = Mouse.Hit.p
        end
    else
        hum.AutoRotate = true
    end
end)

So when i try to execute the command with the autorotate. it wont ask to stop, even i try with hum.AutoRotate = false. But it just keeps going..

Answer this question