JIT
adjusting torso rotation in roblox code to always face forward
this code. local module = {} local Player = game.Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() local HRP = Character:WaitForChild("HumanoidRootPart") local Torso = Character:WaitForChild("Torso") local Mouse = Player:GetMouse() local Using = false function UpdateTorso() local MousePoint = Mouse.Hit.p local LookVector = (MousePoint - HRP.Position).unit LookVector = Vector3.new(LookVector.X, 0, LookVector.Z) local TragetRotation = CFrame.new(HRP.Position, HRP.Position + LookVector) HRP.CFrame = TragetRotation end function UpdateArms() local MousePoint = Mouse.Hit.p local TragetRotation = CFrame.new(HRP.Position + Vector3.new(0,1.5,0), MousePoint) if Character:FindFirstChildWhichIsA("Tool") then Torso:WaitForChild("Right Shoulder").C0 = Torso:WaitForChild("Right Shoulder").C0:lerp((TragetRotation * CFrame.new(1, -1, 0)):toObjectSpace(HRP.CFrame):inverse() * CFrame.Angles(0, math.pi/2, 0), 0.3) Torso:WaitForChild("Left Shoulder").C0 = Torso:WaitForChild("Left Shoulder").C0:lerp((TragetRotation * CFrame.new(-1, -1, 0)):toObjectSpace(HRP.CFrame):inverse() * CFrame.Angles(0, -math.pi/2, 0), 0.3) else Torso:WaitForChild("Right Shoulder").C0 = Torso:WaitForChild("Right Shoulder").C0:lerp((CFrame.new(1, 0.5, 0) * CFrame.Angles(0, math.pi/2, 0)), 0.3) Torso:WaitForChild("Left Shoulder").C0 = Torso:WaitForChild("Left Shoulder").C0:lerp((CFrame.new(-1, 0.5, 0) * CFrame.Angles(0, -math.pi/2, 0)), 0.3) end end function module:Enable() if Character:FindFirstChild("RotationValue") then Character.RotationValue:Destroy() end local RotationValue = Instance.new("BoolValue") RotationValue.Name = "RotationValue" RotationValue.Parent = Character game.Debris:AddItem(RotationValue, 3) end task.spawn(function() game["Run Service"].RenderStepped:Connect(function() if Character:FindFirstChild("RotationValue") then if Character:FindFirstChildWhichIsA("Tool") then UpdateTorso() UpdateArms() else Torso:WaitForChild("Right Shoulder").C0 = Torso:WaitForChild("Right Shoulder").C0:lerp((CFrame.new(1, 0.5, 0) * CFrame.Angles(0, math.pi/2, 0)), 0.3) Torso:WaitForChild("Left Shoulder").C0 = Torso:WaitForChild("Left Shoulder").C0:lerp((CFrame.new(-1, 0.5, 0) * CFrame.Angles(0, -math.pi/2, 0)), 0.3) end else Torso:WaitForChild("Right Shoulder").C0 = Torso:WaitForChild("Right Shoulder").C0:lerp((CFrame.new(1, 0.5, 0) * CFrame.Angles(0, math.pi/2, 0)), 0.3) Torso:WaitForChild("Left Shoulder").C0 = Torso:WaitForChild("Left Shoulder").C0:lerp((CFrame.new(-1, 0.5, 0) * CFrame.Angles(0, -math.pi/2, 0)), 0.3) end end) end) return module make it that it sets the torso to 90 degrees forward. always. without the looking or whatever.
Updated files
v1