local player = game.Players.LocalPlayer
local character = player.Character
if not character or not character.Parent then
character = player.CharacterAdded:wait()
tor = character:WaitForChild("UpperTorso").Waist
hum = character:WaitForChild("Humanoid")
end
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)
if (cam.Focus.p-cam.CoordinateFrame.p).magnitude > 1 then -- so u dont spin weirdly if u look at ur body ig.
but u should do print(cam.Focus.p , cam.CoordinateFrame.p)
waist.C0 = Rotation Cframe.new(part1position,part2position) example part1position will look to part2position
This line basically does the rotation part, it takes the First position as the waist’s position & the second arguement is the lookAt, so it basically makes the waist look towards the mouse hit Position.