Hi everyone,
I’d like to make the player’s arm rotate to face their mouse, but it seems to be rotating from the middle of the torso and not the top like I’d like.
I’m pretty unfamiliar with welds, so I don’t know how to offset the origin.
Here’s the LocalScript:
wait(2)
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local plr = Players.LocalPlayer
local char = plr.Character
local mouse = plr:GetMouse()
local armOffset = char.Torso.CFrame:Inverse() * char["Right Arm"].CFrame
local armWeld = Instance.new("Weld")
armWeld.Part0 = char.Torso
armWeld.Part1 = char["Right Arm"]
armWeld.Parent = char
RunService.Heartbeat:Connect(function()
local cframe = CFrame.new(char.Torso.Position, mouse.Hit.Position) * CFrame.Angles(math.pi/2, 0, 0)
armWeld.C0 = armOffset * char.Torso.CFrame:toObjectSpace(cframe)
end)
Also, I’d like to have player arm rotation to be visible for all players. Is there any way to do that?
Thank you!