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

How do I change the arm position with CFrame?

Asked by 6 years ago
Edited 6 years ago
script.Parent.d.ClickDetector.MouseClick:Connect(function(player)
    local humanoid = player.Character.Humanoid
    if humanoid then
        local armweld = player.Character.Torso:FindFirstChild("Left Shoulder")
        armweld.C0 = armweld.C0.CFrame.fromEulerAnglesXYZ(0, 0, 90)
    end
end)

It works but it keeps giving me weird/broken positions. I am trying to make it seem like I am holding A tool.

0
Don't repost problems. To properly format your code, click the blue Lua icon which will insert two lines of "~~~~". Then place your code in between these two lines. xPolarium 1388 — 6y
0
I only reposted because I couldn't find my first post even when I clicked "mine" ixUltraz 28 — 6y

1 answer

Log in to vote
0
Answered by
tantec 305 Moderation Voter
6 years ago
Edited 6 years ago

You have made one error in your script, C0 is already a CFrame value so you don't have to do...

armweld.C0.CFrame

Also another thing you should have done is just added from the current CFrame that you had to work with so it should've be something like this...

armweld.C0 = armweld.C0 * CFrame.fromEulerAnglesXYZ(0, 0, 90)
-- if you wanted to add position you should add another * cframe like this
armweld.C0 = armweld.C0 * CFrame.fromEulerAnglesXYZ(0, 0, 90) * CFrame.new(0,0,0) --whatever you want

Yet another thing!!!!!! When using CFrame Angles, the Angles work in some other different kind of rotation system so you should make it so it does it in radians, this will make it so you can use the normal rotation system. This is how it should be done

armweld.C0 = armweld.C0 * CFrame.fromEulerAnglesXYZ(math.rad(0), math.rad(0), math.rad(90)) * CFrame.new(0,0,0)

If this helped please accept my answer! ~tantec

0
scriptinghelpers this script block thing isnt working! tantec 305 — 6y
0
nevermind :') tantec 305 — 6y
0
The arms go all the way below the baseplate. ixUltraz 28 — 6y
0
It seems like the position was changed not the angle ixUltraz 28 — 6y
View all comments (6 more)
0
Nvm I got it to work ixUltraz 28 — 6y
0
pls accept answer ;c tantec 305 — 6y
0
no stop being greedy User#19524 175 — 6y
0
wow you have 5414, its very ironic coming from you :( tantec 305 — 6y
0
Accepted ixUltraz 28 — 6y
0
yay thanks tantec 305 — 6y
Ad

Answer this question