Duplicating a tool makes a script in it not work? Why does it do this?
I am making a game with a gun shop and the guns have a script in them that makes you hold the gun how I want them to. Yet its not an animation. But whenever I replicate it the script stops working? Can someone please help me. This is the script:
04 | RW, LW = Instance.new( "Weld" ), Instance.new( "Weld" ) |
06 | function WaitForChild(obj, ch_n) |
08 | while not obj:FindFirstChild(ch_n) and time() - t < 10 do wait( 0.1 ) end |
09 | return obj:FindFirstChild(ch_n) |
11 | script.Parent.Equipped:connect( function () |
12 | if script.Parent.Parent:FindFirstChild( "Humanoid" ) then |
13 | if selected then return end |
15 | player = game.Players:playerFromCharacter(script.Parent.Parent) |
16 | local ch = script.Parent.Parent |
17 | WaitForChild(ch, "Torso" ) |
18 | RSH = WaitForChild(ch.Torso, "Right Shoulder" ) |
19 | LSH = WaitForChild(ch.Torso, "Left Shoulder" ) |
20 | GRP = WaitForChild(ch [ "Right Arm" ] , "RightGrip" ) |
27 | RW.C 0 = CFrame.new( 1.5 , 0.5 , 0 ) |
28 | RW.C 1 = CFrame.new( 0 , 0.5 , 0 ) |
29 | RW.Part 1 = ch [ "Right Arm" ] |
34 | LW.C 0 = CFrame.new(- 1.5 , 0.5 , 0 ) |
35 | LW.C 1 = CFrame.new( 0 , 0.5 , 0 ) |
36 | LW.Part 1 = ch [ "Left Arm" ] |
43 | RW.C 0 = CFrame.new( 1.5 , 0.5 , 0.25 ) * CFrame.fromEulerAnglesXYZ( 1.3 *i, 0 , - 0.5 *i) |
44 | LW.C 0 = CFrame.new(- 1.5 , 0.5 , 0 ) * CFrame.fromEulerAnglesXYZ( 1.7 *i, 0 , 0.8 *i) |
45 | LW.C 1 = CFrame.new( 0.3 *i, 1 + 1 *i, 0 ) |
48 | local rg = (ch [ "Right Arm" ] :FindFirstChild( "RightGrip" ) or GRP) |
50 | GRP.Parent = ch [ "Right Arm" ] |
55 | script.Parent.Unequipped:connect( function () |
58 | RW.C 0 = CFrame.new( 0 , 0 , 0 ) * CFrame.fromEulerAnglesXYZ( 0 , 0 , 0 ) |
59 | LW.C 0 = CFrame.new( 0 , 0 , 0 ) * CFrame.fromEulerAnglesXYZ( 0 , 0 , 0 ) |
60 | LW.C 1 = CFrame.new( 0 , 0 , 0 ) |
63 | RSH.Part 1 = pl.Character [ "Right Arm" ] |
64 | LSH.Part 1 = pl.Character [ "Left Arm" ] |
69 | LW.C 0 = CFrame.new(- 1.5 , 0.5 , 0 ) * CFrame.fromEulerAnglesXYZ( 1.3 *i, 0 , 0.9 *i) |
70 | LW.C 1 = CFrame.new( 0.3 *i, 1 + 1 *i, 0 ) |
74 | for i = 0 , 0.3 , 0.06 do |
76 | GRP.C 0 = CFrame.new( 0 +i, - 1 -i, 0 +( 2 *i)) * CFrame.fromEulerAnglesXYZ(- 2.22 , - 0.45 , 0.42 ) |
77 | LW.C 0 = CFrame.new(- 1 , 0.5 , 0 ) * CFrame.fromEulerAnglesXYZ( 4.2 , 0 , 2.9 ) |
78 | LW.C 1 = CFrame.new( 0.8 *i, 1.1 +i, - 0.3 ) |
82 | RW.C 0 = CFrame.new( 1.5 , 0.5 , 0.25 ) * CFrame.fromEulerAnglesXYZ( 1.3 , 0 , - 0.5 ) |
83 | LW.C 0 = CFrame.new(- 1.5 , 0.5 , 0 ) * CFrame.fromEulerAnglesXYZ( 1.7 , 0 , 0.8 ) |
84 | LW.C 1 = CFrame.new( 0.3 , 1 + 1 , 0 ) |
85 | GRP.C 0 = CFrame.new( 0 , - 1 , - 0.5 ) * CFrame.fromEulerAnglesXYZ(- 1.22 , - 0.45 , 0.22 ) |