The character moves with the gun.
-Script
local RunService = game:GetService("RunService")
local player = Players.LocalPlayer
local mouse = player:GetMouse()
local tool = player.Backpack:WaitForChild("Tool")
local bodyAttach = tool:WaitForChild("BodyAttach")
local function rotateTool()
local worldPosition = bodyAttach.Position
local lookVector = (mouse.Hit.Position - worldPosition).unit
local horizontalRotation = math.atan2(lookVector.X, lookVector.Z)
bodyAttach.CFrame = CFrame.new(worldPosition) * CFrame.Angles(0, horizontalRotation, 0)
end
RunService.RenderStepped:Connect(function()
if tool:IsA("Tool") and tool.Parent == player.Character then
rotateTool()
end
end)