I am wanting to make it so the arms follow the mouse, so if your mouse is up, your arms go up, etc.
The issue is that my game is R6, and my current script only works for R15.
I have tried more DevForum, but there all for R15, and the ones that are R6 don’t seem to work.
My R15 code in local script in StarterPlayerScripts (Works for R15 but not R6)
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local plr = Players.LocalPlayer
local mouse = plr:GetMouse()
local char = plr.Character or plr.CharacterAdded:Wait()-- the character (you can probably easily get a reference to it somehow)
local leftShoulder = char:WaitForChild("LeftUpperArm"):WaitForChild("LeftShoulder")
local rightShoulder = char:WaitForChild("RightUpperArm"):WaitForChild("RightShoulder")
local function rotateArms()
local dir = mouse.Hit.Position - mouse.Origin.Position
local angle = math.atan2(dir.Y, math.sqrt(dir.X^2+dir.Z^2))
local rotationCf = CFrame.Angles(angle, 0, 0)
local orgLeftTransform, orgRightTransform = leftShoulder.Transform, rightShoulder.Transform
local orgLeftPos, orgRightPos = orgLeftTransform.Position, orgRightTransform.Position
leftShoulder.Transform, rightShoulder.Transform = rotationCf*(orgLeftTransform-orgLeftPos)+orgLeftPos, rotationCf*(orgRightTransform-orgRightPos)+orgRightPos
end
RunService.Stepped:Connect(rotateArms)
Thanks!