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

How can you make a duel wield weapon?

Asked by 8 years ago

I want to know how can you make the left arm raise up like the right arm when holding a weapon. I acknowledge that there is a child inside the right arm whenever you hold a tool up(Which is sorta like a weld). Just that how can I obtain that property and do the same. I know I can use the "Equipped" function, but my major concern is how to get "Weld". Please, Thank you.

2 answers

Log in to vote
1
Answered by 8 years ago

Here's how you do it (in concept, I haven't done it before, but it should work):


Step 1.

Inside tools, there should be a property called "RequiresHandle" (or something like that, I don't have access to the wiki at the moment). Find it and disable it. Create the parts for the tool, and put them in their own individual models inside the tool, like the following:

  • Tool
    • LeftSword
      • Handle
      • Part
    • RightSword
      • Handle
      • Part

For ease of use, set each of the models' PrimaryParts to their Handle.

Step 2.

Create a LocalScript inside the tool. Name it 'ToolHandler'. This won't work with FE if you're intending to do server stuff (like hurting other players), but I could help you with that if you need it. Change the script's code to this:

01local tool = script.Parent
02local ls = tool:WaitForChild("LeftSword") -- or your model's name
03local rs = tool:WaitForChild("RightSword") -- or your other model's name
04local lh = ls.PrimaryPart -- the left handle
05local rh = rs.PrimaryPart -- the right handle
06local p = game.Players.LocalPlayer
07local char = p.Character
08local la = char:WaitForChild("Left Arm")
09local ra = char:WaitForChild("Right Arm")
10 
11function weld(h,obj) -- function for welding
12    local w = Instance.new("Weld") -- new weld
13    w.Part0 = h -- sets the first part
14    w.Part1 = obj -- sets the second part
15    local cf = CFrame.new(obj.Position) -- defines cframe for below
View all 36 lines...

That's hopefully all the code you will need. You should be able to make other things work now if you coded them. The swords should now be welded to the character and should disappear and reappear when equipped/unequipped. Tell me if this doesn't work, I'll try and help later :)

~TDP


TIP

You can use animations in tools easily, there is no need to animate with CFrame anymore!

0
Another great answer from TDP! UniversalDreams 205 — 8y
Ad
Log in to vote
-1
Answered by 8 years ago

As far as I know, there is no weld for the left arm. You will simply have to make the weld yourself and animate the tool by changing the C0 and C1 properties of that weld... Someone correct me if I am wrong about this

Answer this question