Can someone please explain the following code:
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
waist.C0 = CFrame.new(waist.C0.p, Vector3.new(Mouse.Hit.p.x,Mouse.Hit.p.y,Mouse.Hit.p.z))
prev_mousehit = Mouse.Hit.p
end
else
hum.AutoRotate = true
end
end)
Full code:
local cam = game.Workspace.CurrentCamera
local equipped = false
local waist
local hum
player.CharacterAdded:Connect(function()
character = player.Character
waist = character:WaitForChild("UpperTorso"):WaitForChild("Waist")
hum = character:WaitForChild("Humanoid")
end)
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
waist.C0 = CFrame.new(waist.C0.p, Vector3.new(Mouse.Hit.p.x,Mouse.Hit.p.y,Mouse.Hit.p.z))
prev_mousehit = Mouse.Hit.p
end
else
hum.AutoRotate = true
end
end)