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:
For ease of use, set each of the models' PrimaryPart
s 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:
01 | local tool = script.Parent |
02 | local ls = tool:WaitForChild( "LeftSword" ) |
03 | local rs = tool:WaitForChild( "RightSword" ) |
04 | local lh = ls.PrimaryPart |
05 | local rh = rs.PrimaryPart |
06 | local p = game.Players.LocalPlayer |
07 | local char = p.Character |
08 | local la = char:WaitForChild( "Left Arm" ) |
09 | local ra = char:WaitForChild( "Right Arm" ) |
12 | local w = Instance.new( "Weld" ) |
15 | local cf = CFrame.new(obj.Position) |
16 | w.C 0 = h.CFrame:inverse() * cf |
17 | w.C 1 = obj.CFrame:inverse() * cf |
19 | w.Name = h.Name.. "-" ..obj.Name.. "Weld" |
22 | for _,v in pairs (ls:GetChildren()) do |
23 | if v ~ = lh and v:IsA( "BasePart" ) then |
30 | for _,v in pairs (rs:GetChildren()) do |
31 | if v ~ = rh and v:IsA( "BasePart" ) then |
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!