before we begin, i’m not good at english, sorry.
i want to make character’s arm follow mouse on y-axis, so i tried code from a youtube tutorial.
but it didn’t work. i guess it’s because character’s torso is rotated. however i don’t know what to do.
i have read a lot of topics about it… but i couldn’t find answer.
video:
my code:
local RunService = game:GetService("RunService")
local PlayerService = game:GetService("Players")
local plr = PlayerService.LocalPlayer
local cam = workspace.CurrentCamera
local chr = plr.Character
local torso:BasePart = chr["Torso"]
local right_shoulder:Motor6D = torso["Right Shoulder"]
local right_shoulder_origin = right_shoulder.C0
local left_shoulder:Motor6D = torso["Left Shoulder"]
local left_shoulder_origin = left_shoulder.C0
RunService.Stepped:Connect(function()
local camDir = torso.CFrame:ToObjectSpace(cam.CFrame).LookVector
right_shoulder.C0 = right_shoulder_origin*CFrame.Angles(0,0,camDir.Y)
left_shoulder.C0 = left_shoulder_origin*CFrame.Angles(0,0,-camDir.Y)
end)
thank you for reading.