local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local tool = script.Parent -- The tool should be in the player's tool slot
local toolHandle = tool:WaitForChild("Handle") -- Tool handle part
local rightHand = character:WaitForChild("RightHand")
local rightGrip = rightHand:WaitForChild("RightGrip") -- RightGrip is the Weld object
-- Store the default position of the RightGrip and RightHand
local defaultGripCFrame = rightGrip.C0 -- RightGrip C0 (tool position/rotation relative to the hand)
local defaultToolPosition = toolHandle.Position
-- Function to update the tool's orientation
local function updateToolOrientation()
-- Get the current CFrame of the tool handle
local toolPosition = toolHandle.Position
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
-- Get the direction to the player's facing position (ignoring the Y-axis for horizontal rotation)
local directionToPlayer = (humanoidRootPart.Position - toolPosition).unit
local forwardDirection = Vector3.new(directionToPlayer.X, 0, directionToPlayer.Z).unit
-- Calculate the target CFrame for the tool's handle (horizontal direction)
local targetCFrame = CFrame.new(toolPosition, toolPosition + forwardDirection)
-- Get the mouse's 3D world position and use it to calculate the tilt
local mouse = player:GetMouse()
local mousePosition = mouse.Hit.p -- Mouse's position in world space
-- Calculate the direction from the tool to the mouse's position
local directionToMouse = (mousePosition - toolPosition).unit
-- Allow free vertical tilt (rotation along the X-axis)
local tiltAngle = math.asin(directionToMouse.Y) -- Get the vertical tilt based on mouse's Y position
local verticalTilt = CFrame.Angles(tiltAngle, 0, 0) -- Vertical tilt rotation on the X-axis
-- Adjust the weld's C0 to apply the tilt while keeping the horizontal rotation intact
rightGrip.C0 = defaultGripCFrame * verticalTilt
-- Apply the horizontal direction
rightGrip.C0 = rightGrip.C0 * targetCFrame.RotVelocity -- Apply the direction (horizontal rotation)
end
-- Update tool orientation every frame (smooth rotation update)
game:GetService("RunService").RenderStepped:Connect(updateToolOrientation)
Thoughts? Feedback? Let me know! I hope this helps for anyone who didn’t already know how to do this