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

How would you Grab A Players Arm Through A Hopper Bin?

Asked by
IcyEvil 260 Moderation Voter
9 years ago

Its for a tool my friend has asked me to make, Which involves Hopper Bins, And If anyone could tell me what kind of Math would be used in the Cframe's as well

like

arm.CFrame = CFrame.new( math.sin(5 * 6) )

Or something Like that, It would be much appreciated!

EDIT

I Forgot to mention it is for a prayer Tool Sorry.

1 answer

Log in to vote
0
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
9 years ago

I would be careful, because what you're doing with a 'prayer' tool might be classified as religious discrimination.

What you're ttempting to do, rotate the arms into a 'Praying' position, requires you to edit the welds in both the player's arms. To edit the welds, we need to look at the C0 and C1 properties of the weld. The welds are placed in the Character's Torso, named Right Shoulder, and Left Shoulder.

So, to do this.. it would look something like this;

Made this off the top of my head, so most likely you're going to have to mess around with the CFrame values / Rotations

local tool = script.Parent --Define the hopperbin
local plr = game.Players.LocalPlayer
local weldHolder = plr.Characrer.Torso

--Praying arms
function prayArms()
    local leftArm = weldHolder["Left Shoulder"]
    local rightArm = weldHolder["Right Shoulder"]

    leftArm.C0 = CFrame.new(2,.5,0) --Offset from the Torso
                * CFrame.Angles(math.rad(45),math.rad(90),0) --Rotate it.

    rightArm.C0 = CFrame.new(-2,.5,0)
                * CFrame.Angles(math.rad(-45),math.rad(90),0)
end

--Normal Arms
function normalArms()
    local leftArm = weldHolder["Left Shoulder"]
    local rightArm = weldHolder["Right Shoulder"]

    leftArm.C0 = CFrame.new(2,.5,0)

    rightArm.C0 = CFrame.new(-2,.5,0)
end

--Connect the functions to your tool.
tool.Selected:connect(function(mouse)
    mouse.Button1Down:connect(function()
        prayArms()
    end)
    mouse.Button1Up:connect(function()
        normalArms()
    end)
end)

0
Thanks! You Explained this Very well. IcyEvil 260 — 9y
Ad

Answer this question