Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make the Arms of an R6 body follow mouse?

Asked by 4 years ago

I've made this code and it points to mouse it just is inside of the body for some reason?


repeat wait() until game.Players.LocalPlayer.Character local body = game.Players.LocalPlayer.Character local left_arm = body["Left Arm"] local right_arm = body["Right Arm"] local mouse = game.Players.LocalPlayer:GetMouse() -- leftDown = false rightDown = false mouse.Button1Down:Connect(function() leftDown = true end) mouse.Button1Up:Connect(function() leftDown = false end) mouse.Button2Down:Connect(function() rightDown = true end) mouse.Button2Up:Connect(function() rightDown = false end) -- local leftArmWeld = Instance.new("Weld") leftArmWeld.Parent = body leftArmWeld.Part0 = body.Torso leftArmWeld.Part1 = left_arm leftArmWeld.Name = "LeftArmWeld" local rightArmWeld = Instance.new("Weld") rightArmWeld.Parent = body rightArmWeld.Part0 = body.Torso rightArmWeld.Part1 = right_arm leftArmWeld.Name = "RightArmWeld" local armoffset_left = body.Torso.CFrame:Inverse() * body["Left Arm"].CFrame local armoffset_right = body.Torso.CFrame:Inverse() * body["Right Arm"].CFrame mouse.Move:Connect(function() local x,y,z = CFrame.new(body["Left Arm"].Position,mouse.Hit.Position):ToEulerAnglesXYZ() local x1,y1,z1 = CFrame.new(body["Right Arm"].Position,mouse.Hit.Position):ToEulerAnglesXYZ() if leftDown then leftArmWeld.C0 = armoffset_left * CFrame.fromEulerAnglesXYZ(x,y,z) * CFrame.fromEulerAnglesXYZ(math.rad(90),0,0) else leftArmWeld.C0 = armoffset_left end end)
0
It may also be an issue with where the location you put it in. Did you watch a tutorial? Waydo790 0 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Well, There doesn't seem to be any problem with the CFrame Coding. The lines I have read do not seem correct though, Maybe rearrange a bit of the start and kind of to the 25% mark. Or if you want r15 You can try finding my post.

Look's good from my perspective, so I won't say anything about it.

You can use your opinion.

Ad

Answer this question