Why do my weapons break whenever I equip them?
I'm trying to create two weapons, both with a handle on it. So to be clear, I am making a single tool that has two weapons in it. I just cannot get it to work no matter what. I have tried welding the whole thing together and I've also tried to weld just the two weapons by themselves if that makes any sense. All I can say is that I have had no success with making these weapons go by my hands. The only thing that happens is the weapon goes into my right hand and that's it, but I don't want that to happen, i want one weapon in one hand and one weapon in the other hand. Please tell me what I am doing wrong.
If I put this code in a local script in the weapon, the handle goes in my hand... but literally nothing else, not even the other handle. I have named them correctly, handle and handle1.
01 | player = game.Players.LocalPlayer |
02 | character = player.Character |
03 | LArm = script.Parent.Parent:WaitForChild( "Left Arm" ) |
04 | RArm = script.Parent.Parent:WaitForChild( "Right Arm" ) |
06 | local w 1 = Instance.new( "Weld" ) |
07 | w 1. Parent = script.Parent.Handle |
09 | w 1. Part 1 = script.Parent.Handle |
10 | w 1. C 1 = CFrame.fromEulerAnglesXYZ( 1 , 0 , 0 ) * CFrame.new(RArm.Position.CFrame.new( 0 , 0 , 0 ), 0 , 0 ) |
13 | local w 2 = Instance.new( "Weld" ) |
14 | w 2. Parent = script.Parent.Handle |
16 | w 2. Part 1 = script.Parent.Handle 1 |
17 | w 2. C 1 = CFrame.fromEulerAnglesXYZ( 0 , 0 , 0 ) * CFrame.new(LArm.Position.CFrame.new( 0 , 0 , 0 ), 0 , 0 ) |
19 | script.Parent.Equipped:connect(KaiWeld) |
20 | script.Parent.Unequipped:connect(KaiWeld) |
I also have this piece of code which basically keeps the weapon together. Without this, the weapon just falls apart and breaks. I don't know why, but this script won't let me choose the position of the handles and I want to be able to choose the position of EACH handle.
03 | local function scan(parent) |
04 | for _,v in pairs (parent:GetChildren()) do |
05 | if (v:IsA( "BasePart" )) then |
07 | local w = Instance.new( "Weld" ) |
08 | w.Name = ( "%s_Weld" ):format(v.Name) |
09 | w.Part 0 ,w.Part 1 = last,v |
10 | w.C 0 = last.CFrame:inverse() |
11 | w.C 1 = v.CFrame:inverse() |
21 | for _,v in pairs (parts) do |