Advertisement
mathmasterphil

Vint

Mar 7th, 2015
336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 55.16 KB | None | 0 0
  1. --[[                                              
  2. Script shared by eletronix                                              ]]
  3.  
  4. if script == nil then return end
  5.  
  6.  
  7. Player = Game.Players.LocalPlayer
  8. Char = Player.Character
  9. animate = Char:findFirstChild("Animate")
  10. if animate then
  11. animate:Destroy()
  12. Name = "VSS Vintorez"
  13. selected = false
  14. canDual = false
  15. dual = false
  16. Button1Down = false
  17. damage = 50
  18. canFire = true
  19. canFire2 = false
  20. readyTime = 0.2
  21. automatic = false
  22. burst = false
  23. burstCount = 0
  24. burstCountMax = 3
  25. canSilence = false
  26. silenced = false
  27. canZoom = true
  28. zoom = false
  29. switchToSingle = true
  30. switchToBurst = false
  31. switchToAutomatic = true
  32.  
  33.  
  34. ammoGui = Instance.new("ScreenGui")
  35. ammoGui.Name = Name
  36. local frame = Instance.new("Frame")
  37. frame.Name = "Frame"
  38. frame.Size = UDim2.new(0, 165, 0, 60)
  39. frame.Position = UDim2.new(0, 0, 1, -60)
  40. frame.BackgroundColor3 = Color3.new(1, 1, 1)
  41. frame.BorderColor3 = Color3.new(0, 0, 0)
  42. frame.Parent = ammoGui
  43. local label = Instance.new("TextLabel")
  44. label.Name = "Weapon"
  45. label.Text = "Weapon: " ..Name
  46. label.Size = UDim2.new(1, 0, 0, 20)
  47. label.Position = UDim2.new(0, 0, 0, 0)
  48. label.BackgroundColor3 = Color3.new(1, 0, 0)
  49. label.BorderColor3 = Color3.new(0, 0, 0)
  50. label.Parent = frame
  51. local label = Instance.new("TextLabel")
  52. label.Name = "MagazinePrefix"
  53. label.Text = "    Magazine:"
  54. label.TextXAlignment = "Left"
  55. label.Size = UDim2.new(1, 0, 0, 20)
  56. label.Position = UDim2.new(0, 0, 0, 20)
  57. label.BackgroundColor3 = Color3.new(1, 1, 1)
  58. label.BorderColor3 = Color3.new(0, 0, 0)
  59. label.Parent = frame
  60. local label = Instance.new("TextLabel")
  61. label.Name = "Magazine"
  62. label.Text = "0/0"
  63. label.TextXAlignment = "Right"
  64. label.Size = UDim2.new(1, 0, 0, 20)
  65. label.Position = UDim2.new(0, -10, 0, 20)
  66. label.BackgroundTransparency = 1
  67. label.BorderSizePixel = 0
  68. label.Parent = frame
  69. local label = Instance.new("TextLabel")
  70. label.Name = "AmmoPrefix"
  71. label.Text = "    Ammunition:"
  72. label.TextXAlignment = "Left"
  73. label.Size = UDim2.new(1, 0, 0, 20)
  74. label.Position = UDim2.new(0, 0, 0, 40)
  75. label.BackgroundColor3 = Color3.new(1, 1, 1)
  76. label.BorderColor3 = Color3.new(0, 0, 0)
  77. label.Parent = frame
  78. local label = Instance.new("TextLabel")
  79. label.Name = "Ammo"
  80. label.Text = "0/0"
  81. label.TextXAlignment = "Right"
  82. label.Size = UDim2.new(1, 0, 0, 20)
  83. label.Position = UDim2.new(0, -10, 0, 40)
  84. label.BackgroundTransparency = 1
  85. label.BorderSizePixel = 0
  86. label.Parent = frame
  87.  
  88.  
  89. function updateGui()
  90.     if selected == false then return end
  91.     if Player:FindFirstChild("PlayerGui") == nil then Instance.new("PlayerGui").Parent = Player end
  92.     if Player.PlayerGui:FindFirstChild(Name) == nil then
  93.         ammoGui:Clone().Parent = Player.PlayerGui
  94.     end
  95.     Player.PlayerGui[Name].Frame.Magazine.Text = tostring(magazine.Value).. "/" ..tostring(magazineMax.Value)
  96.     Player.PlayerGui[Name].Frame.Ammo.Text = tostring(ammo.Value).. "/" ..tostring(ammoMax.Value)
  97. end
  98.  
  99.  
  100.  
  101. function makeParts(format)
  102.     local model = Instance.new("Model")
  103.     model.Name = Name
  104.     local pm = Instance.new("Part")
  105.     pm.Name = "Handle"
  106.     pm.FormFactor = "Custom"
  107.     pm.Size = Vector3.new(1, 1, 1)
  108.     pm.BrickColor = BrickColor.new("Black")
  109.     pm.Locked = true
  110.     pm.TopSurface = 0
  111.     pm.BottomSurface = 0
  112.     pm.Parent = model
  113.     local m = Instance.new("SpecialMesh")
  114.     m.MeshType = "Brick"
  115.     m.Scale = Vector3.new(0.3, 0.75, 0.4)
  116.     m.Parent = pm
  117.     if format ~= nil then
  118.         local w = Instance.new("Weld")
  119.         w.Part0 = pm
  120.         if format == "RightHand" then
  121.             w.Part1 = Player.Character:FindFirstChild("Right Arm")
  122.             w.C0 = CFrame.new(0, 1.4, 0.5)
  123.             w.C1 = CFrame.new()
  124.         elseif format == "RightHolster" then
  125.             w.Part1 = Player.Character:FindFirstChild("Torso")
  126.             w.C0 = CFrame.new(0.65, -0.7, 0.9) * CFrame.fromEulerAnglesXYZ(math.rad(5), math.rad(-90), 0)
  127.             w.C1 = CFrame.new()
  128.             model.Name = Name.. " (Holstered)"
  129.         end
  130.         w.Parent = pm
  131.         model.Parent = Player.Character
  132.     end
  133.     --[[
  134.     sniper1  http://www.roblox.com/Asset/?id=1868836
  135.     equip    http://www.roblox.com/Asset/?id=13510737
  136.     fire1     http://www.roblox.com/Asset/?id=2760979
  137.     fire2    http://www.roblox.com/Asset/?id=13510352
  138.     fire3    http://www.roblox.com/Asset/?id=2692806
  139.     fire4    http://www.roblox.com/Asset/?id=2691586
  140.     fire5    http://www.roblox.com/Asset/?id=2920959
  141.     fire6    http://www.roblox.com/Asset/?id=2697431
  142.     fire7    http://www.roblox.com/Asset/?id=2920959
  143.     reload1   http://www.roblox.com/Asset/?id=2691591
  144.     reload2   http://www.roblox.com/Asset/?id=2697432
  145.     reload3  http://www.roblox.com/Asset/?id=2920960
  146.     reload4  http://www.roblox.com/Asset/?id=2761842
  147.     shotgun1 http://www.roblox.com/Asset/?id=2697294
  148.     --]]
  149.     local s = Instance.new("Sound")
  150.     s.Name = "Equip"
  151.     s.SoundId = "http://www.roblox.com/Asset/?id=10209881"
  152.     s.Volume = 1
  153.     s.Pitch = 1
  154.     s.Looped = false
  155.     s.Parent = pm
  156.     local s = Instance.new("Sound")
  157.     s.Name = "Fire"
  158.     s.SoundId = "http://www.roblox.com/Asset/?id=10209875"
  159.     s.Volume = 1
  160.     s.Pitch = 1
  161.     s.Looped = false
  162.     s.Parent = pm
  163.     local s = Instance.new("Sound")
  164.     s.Name = "Reload"
  165.     s.SoundId = "http://www.roblox.com/Asset/?id=2691591"
  166.     s.Volume = 1
  167.     s.Pitch = 1.25
  168.     s.Looped = false
  169.     s.Parent = pm
  170.     local s = Instance.new("Sound")
  171.     s.Name = "Empty"
  172.     s.SoundId = "http://www.roblox.com/Asset/?id=2697295"
  173.     s.Volume = 1
  174.     s.Pitch = 5
  175.     s.Looped = false
  176.     s.Parent = pm
  177.     local s = Instance.new("Sound")
  178.     s.Name = "Switch"
  179.     s.SoundId = "http://www.roblox.com/Asset/?id=2697295"
  180.     s.Volume = 1
  181.     s.Pitch = 10
  182.     s.Looped = false
  183.     s.Parent = pm
  184.     local p = Instance.new("Part")
  185.     p.Name = "ShellOut"
  186.     p.FormFactor = "Custom"
  187.     p.Size = Vector3.new(1, 1, 1)
  188.     p.Transparency = 1
  189.     p.Locked = true
  190.     p.CanCollide = false
  191.     p.TopSurface = 0
  192.     p.BottomSurface = 0
  193.     p.Parent = model
  194.     local w = Instance.new("Weld")
  195.     w.Part0 = p
  196.     w.Part1 = pm
  197.     w.C0 = CFrame.new(0, 0, 1) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  198.     w.C1 = CFrame.new()
  199.     w.Parent = p
  200.     local p = Instance.new("Part")
  201.     p.Name = "Grip"
  202.     p.FormFactor = "Custom"
  203.     p.Size = Vector3.new(1, 1, 1)
  204.     p.BrickColor = BrickColor.new("Reddish brown")
  205.     p.Material = "Wood"
  206.     p.Locked = true
  207.     p.TopSurface = 0
  208.     p.BottomSurface = 0
  209.     p.Parent = model
  210.     local m = Instance.new("SpecialMesh")
  211.     m.MeshType = "Brick"
  212.     m.Scale = Vector3.new(0.29, 0.35, 0.9)
  213.     m.Parent = p
  214.     local w = Instance.new("Weld")
  215.     w.Part0 = p
  216.     w.Part1 = pm
  217.     w.C0 = CFrame.new(0, -0.25, -0.6) * CFrame.fromEulerAnglesXYZ(math.rad(15), 0, 0)
  218.     w.C1 = CFrame.new()
  219.     w.Parent = p
  220.     local p = Instance.new("Part")
  221.     p.Name = "Scope Base"
  222.     p.FormFactor = "Custom"
  223.     p.Size = Vector3.new(1, 1, 1)
  224.     p.BrickColor = BrickColor.new("Black")
  225.     p.Locked = true
  226.     p.TopSurface = 0
  227.     p.BottomSurface = 0
  228.     p.Parent = model
  229.     local m = Instance.new("SpecialMesh")
  230.     m.MeshType = "Brick"
  231.     m.Scale = Vector3.new(0.1, 0.3, 0.1)
  232.     m.Parent = p
  233.     local w = Instance.new("Weld")
  234.     w.Part0 = p
  235.     w.Part1 = pm
  236.     w.C0 = CFrame.new(0, 0, 0.25)
  237.     w.C1 = CFrame.new()
  238.     w.Parent = p
  239.     local p = Instance.new("Part")
  240.     p.Name = "Scope End 1"
  241.     p.FormFactor = "Custom"
  242.     p.Size = Vector3.new(1, 1, 1)
  243.     p.BrickColor = BrickColor.new("Black")
  244.     p.Locked = true
  245.     p.TopSurface = 0
  246.     p.BottomSurface = 0
  247.     p.Parent = model
  248.     local m = Instance.new("CylinderMesh")
  249.     m.Scale = Vector3.new(0.275, 0.375, 0.275)
  250.     m.Parent = p
  251.     local w = Instance.new("Weld")
  252.     w.Part0 = p
  253.     w.Part1 = pm
  254.     w.C0 = CFrame.new(0, -0.4, 0.375)
  255.     w.C1 = CFrame.new()
  256.     w.Parent = p
  257.     local p = Instance.new("Part")
  258.     p.Name = "Scope End 2"
  259.     p.FormFactor = "Custom"
  260.     p.Size = Vector3.new(1, 1, 1)
  261.     p.BrickColor = BrickColor.new("Institutional white")
  262.     p.Locked = true
  263.     p.TopSurface = 0
  264.     p.BottomSurface = 0
  265.     p.Parent = model
  266.     local m = Instance.new("CylinderMesh")
  267.     m.Scale = Vector3.new(0.275, 0.025, 0.275)
  268.     m.Parent = p
  269.     local w = Instance.new("Weld")
  270.     w.Part0 = p
  271.     w.Part1 = pm
  272.     w.C0 = CFrame.new(0, -0.6, 0.375)
  273.     w.C1 = CFrame.new()
  274.     w.Parent = p
  275.     local p = Instance.new("Part")
  276.     p.Name = "Scope Center 1"
  277.     p.FormFactor = "Custom"
  278.     p.Size = Vector3.new(1, 1, 1)
  279.     p.BrickColor = BrickColor.new("Black")
  280.     p.Locked = true
  281.     p.TopSurface = 0
  282.     p.BottomSurface = 0
  283.     p.Parent = model
  284.     local m = Instance.new("CylinderMesh")
  285.     m.Scale = Vector3.new(0.15, 0.425, 0.15)
  286.     m.Parent = p
  287.     local w = Instance.new("Weld")
  288.     w.Part0 = p
  289.     w.Part1 = pm
  290.     w.C0 = CFrame.new(0, 0, 0.375)
  291.     w.C1 = CFrame.new()
  292.     w.Parent = p
  293.     local p = Instance.new("Part")
  294.     p.Name = "Scope Front 1"
  295.     p.FormFactor = "Custom"
  296.     p.Size = Vector3.new(1, 1, 1)
  297.     p.BrickColor = BrickColor.new("Black")
  298.     p.Locked = true
  299.     p.TopSurface = 0
  300.     p.BottomSurface = 0
  301.     p.Parent = model
  302.     local m = Instance.new("CylinderMesh")
  303.     m.Scale = Vector3.new(0.2, 0.75, 0.2)
  304.     m.Parent = p
  305.     local w = Instance.new("Weld")
  306.     w.Part0 = p
  307.     w.Part1 = pm
  308.     w.C0 = CFrame.new(0, 0.575, 0.375)
  309.     w.C1 = CFrame.new()
  310.     w.Parent = p
  311.     local p = Instance.new("Part")
  312.     p.Name = "Scope Front 2"
  313.     p.FormFactor = "Custom"
  314.     p.Size = Vector3.new(1, 1, 1)
  315.     p.BrickColor = BrickColor.new("Institutional white")
  316.     p.Locked = true
  317.     p.TopSurface = 0
  318.     p.BottomSurface = 0
  319.     p.Parent = model
  320.     local m = Instance.new("CylinderMesh")
  321.     m.Scale = Vector3.new(0.2, 0.01, 0.2)
  322.     m.Parent = p
  323.     local w = Instance.new("Weld")
  324.     w.Part0 = p
  325.     w.Part1 = pm
  326.     w.C0 = CFrame.new(0, 0.95, 0.375)
  327.     w.C1 = CFrame.new()
  328.     w.Parent = p
  329.     local p = Instance.new("Part")
  330.     p.Name = "Magazine Housing / Grip"
  331.     p.FormFactor = "Custom"
  332.     p.Size = Vector3.new(1, 1, 1)
  333.     p.BrickColor = BrickColor.new("Black")
  334.     p.Locked = true
  335.     p.TopSurface = 0
  336.     p.BottomSurface = 0
  337.     p.Parent = model
  338.     local m = Instance.new("SpecialMesh")
  339.     m.MeshType = "Brick"
  340.     m.Scale = Vector3.new(0.3, 1, 0.3)
  341.     m.Parent = p
  342.     local w = Instance.new("Weld")
  343.     w.Part0 = p
  344.     w.Part1 = pm
  345.     w.C0 = CFrame.new(0, 0.7, -0.32) * CFrame.fromEulerAnglesXYZ(math.rad(-12.5), 0, 0)
  346.     w.C1 = CFrame.new()
  347.     w.Parent = p
  348.     local p = Instance.new("Part")
  349.     p.Name = "Magazine"
  350.     p.FormFactor = "Custom"
  351.     p.Size = Vector3.new(1, 1, 1)
  352.     p.BrickColor = BrickColor.new("Black")
  353.     p.Locked = true
  354.     p.TopSurface = 0
  355.     p.BottomSurface = 0
  356.     p.Parent = model
  357.     local m = Instance.new("SpecialMesh")
  358.     m.MeshType = "Brick"
  359.     m.Scale = Vector3.new(0.25, 0.4, 0.6)
  360.     m.Parent = p
  361.     local w = Instance.new("Weld")
  362.     w.Part0 = p
  363.     w.Part1 = pm
  364.     w.C0 = CFrame.new(0, 0.5, -0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-7.5), 0, 0)
  365.     w.C1 = CFrame.new()
  366.     w.Parent = p
  367.     local p = Instance.new("Part")
  368.     p.Name = "Trigger Housing 1"
  369.     p.FormFactor = "Custom"
  370.     p.Size = Vector3.new(1, 1, 1)
  371.     p.BrickColor = BrickColor.new("Black")
  372.     p.Locked = true
  373.     p.TopSurface = 0
  374.     p.BottomSurface = 0
  375.     p.Parent = model
  376.     local m = Instance.new("SpecialMesh")
  377.     m.MeshType = "Brick"
  378.     m.Scale = Vector3.new(0.1, 0.5, 0.025)
  379.     m.Parent = p
  380.     local w = Instance.new("Weld")
  381.     w.Part0 = p
  382.     w.Part1 = pm
  383.     w.C0 = CFrame.new(0, 0.075, -0.4)
  384.     w.C1 = CFrame.new()
  385.     w.Parent = p
  386.     local p = Instance.new("Part")
  387.     p.Name = "Trigger Housing 2"
  388.     p.FormFactor = "Custom"
  389.     p.Size = Vector3.new(1, 1, 1)
  390.     p.BrickColor = BrickColor.new("Black")
  391.     p.Locked = true
  392.     p.TopSurface = 0
  393.     p.BottomSurface = 0
  394.     p.Parent = model
  395.     local m = Instance.new("SpecialMesh")
  396.     m.MeshType = "Brick"
  397.     m.Scale = Vector3.new(0.295, 0.1, 0.38)
  398.     m.Parent = p
  399.     local w = Instance.new("Weld")
  400.     w.Part0 = p
  401.     w.Part1 = pm
  402.     w.C0 = CFrame.new(0, -0.15, -0.225)
  403.     w.C1 = CFrame.new()
  404.     w.Parent = p
  405.     local p = Instance.new("Part")
  406.     p.Name = "Trigger"
  407.     p.FormFactor = "Custom"
  408.     p.Size = Vector3.new(1, 1, 1)
  409.     p.BrickColor = BrickColor.new("Black")
  410.     p.Locked = true
  411.     p.TopSurface = 0
  412.     p.BottomSurface = 0
  413.     p.Parent = model
  414.     local m = Instance.new("SpecialMesh")
  415.     m.MeshType = "Brick"
  416.     m.Scale = Vector3.new(0.1, 0.05, 0.15)
  417.     m.Parent = p
  418.     local w = Instance.new("Weld")
  419.     w.Part0 = p
  420.     w.Part1 = pm
  421.     w.C0 = CFrame.new(0, 0.03, -0.275)
  422.     w.C1 = CFrame.new()
  423.     w.Parent = p
  424.     local p = Instance.new("Part")
  425.     p.Name = "Barrel 1"
  426.     p.CanCollide = false
  427.     p.FormFactor = "Custom"
  428.     p.Size = Vector3.new(1, 1, 1)
  429.     p.BrickColor = BrickColor.new("Black")
  430.     p.Locked = true
  431.     p.TopSurface = 0
  432.     p.BottomSurface = 0
  433.     p.Parent = model
  434.     local m = Instance.new("SpecialMesh")
  435.     m.MeshType = "Brick"
  436.     m.Scale = Vector3.new(0.3, 0.925, 0.4)
  437.     m.Parent = p
  438.     local w = Instance.new("Weld")
  439.     w.Part0 = p
  440.     w.Part1 = pm
  441.     w.C0 = CFrame.new(0, 0.825, 0)
  442.     w.C1 = CFrame.new()
  443.     w.Parent = p
  444.     local p = Instance.new("Part")
  445.     p.Name = "Barrel 2"
  446.     p.FormFactor = "Custom"
  447.     p.Size = Vector3.new(1, 1, 1)
  448.     p.BrickColor = BrickColor.new("Black")
  449.     p.CanCollide = false
  450.     p.Locked = true
  451.     p.TopSurface = 0
  452.     p.BottomSurface = 0
  453.     p.Parent = model
  454.     local m = Instance.new("CylinderMesh")
  455.     m.Scale = Vector3.new(0.275, 2, 0.275)
  456.     m.Parent = p
  457.     local w = Instance.new("Weld")
  458.     w.Part0 = p
  459.     w.Part1 = pm
  460.     w.C0 = CFrame.new(0, 2.25, 0)
  461.     w.C1 = CFrame.new()
  462.     w.Parent = p
  463.     local p = Instance.new("Part")
  464.     p.Name = "Barrel Sight 1"
  465.     p.FormFactor = "Custom"
  466.     p.Size = Vector3.new(1, 1, 1)
  467.     p.BrickColor = BrickColor.new("Black")
  468.     p.CanCollide = false
  469.     p.Locked = true
  470.     p.TopSurface = 0
  471.     p.BottomSurface = 0
  472.     p.Parent = model
  473.     local m = Instance.new("SpecialMesh")
  474.     m.MeshType = "Brick"
  475.     m.Scale = Vector3.new(0.1, 0.3, 0.175)
  476.     m.Parent = p
  477.     local w = Instance.new("Weld")
  478.     w.Part0 = p
  479.     w.Part1 = pm
  480.     w.C0 = CFrame.new(0, 1.4, 0.1)
  481.     w.C1 = CFrame.new()
  482.     w.Parent = p
  483.     local p = Instance.new("Part")
  484.     p.Name = "Barrel Sight 2"
  485.     p.FormFactor = "Custom"
  486.     p.Size = Vector3.new(1, 1, 1)
  487.     p.BrickColor = BrickColor.new("Black")
  488.     p.CanCollide = false
  489.     p.Locked = true
  490.     p.TopSurface = 0
  491.     p.BottomSurface = 0
  492.     p.Parent = model
  493.     local m = Instance.new("SpecialMesh")
  494.     m.MeshType = "Brick"
  495.     m.Scale = Vector3.new(0.1, 0.1, 0.2)
  496.     m.Parent = p
  497.     local w = Instance.new("Weld")
  498.     w.Part0 = p
  499.     w.Part1 = pm
  500.     w.C0 = CFrame.new(0, 3.2, 0.1)
  501.     w.C1 = CFrame.new()
  502.     w.Parent = p
  503.     local p = Instance.new("Part")
  504.     p.Name = "Muzzle"
  505.     p.FormFactor = "Custom"
  506.     p.Size = Vector3.new(1, 1, 1)
  507.     p.Transparency = 1
  508.     p.CanCollide = false
  509.     p.Locked = true
  510.     p.Parent = model
  511.     local w = Instance.new("Weld")
  512.     w.Part0 = p
  513.     w.Part1 = pm
  514.     w.C0 = CFrame.new(0, 3.25, 0)
  515.     w.C1 = CFrame.new()
  516.     w.Parent = p
  517.     local p = Instance.new("Part")
  518.     p.Name = "Stock 1"
  519.     p.CanCollide = false
  520.     p.FormFactor = "Custom"
  521.     p.Size = Vector3.new(1, 1, 1)
  522.     p.BrickColor = BrickColor.new("Reddish brown")
  523.     p.Material = "Wood"
  524.     p.Locked = true
  525.     p.TopSurface = 0
  526.     p.BottomSurface = 0
  527.     p.Parent = model
  528.     local m = Instance.new("SpecialMesh")
  529.     m.MeshType = "Brick"
  530.     m.Scale = Vector3.new(0.3, 1.6, 0.125)
  531.     m.Parent = p
  532.     local w = Instance.new("Weld")
  533.     w.Part0 = p
  534.     w.Part1 = pm
  535.     w.C0 = CFrame.new(0, -1.125, -0.93)
  536.     w.C1 = CFrame.new()
  537.     w.Parent = p
  538.     local p = Instance.new("Part")
  539.     p.Name = "Stock 2"
  540.     p.CanCollide = false
  541.     p.FormFactor = "Custom"
  542.     p.Size = Vector3.new(1, 1, 1)
  543.     p.BrickColor = BrickColor.new("Reddish brown")
  544.     p.Material = "Wood"
  545.     p.Locked = true
  546.     p.TopSurface = 0
  547.     p.BottomSurface = 0
  548.     p.Parent = model
  549.     local m = Instance.new("SpecialMesh")
  550.     m.MeshType = "Brick"
  551.     m.Scale = Vector3.new(0.301, 1.6, 0.175)
  552.     m.Parent = p
  553.     local w = Instance.new("Weld")
  554.     w.Part0 = p
  555.     w.Part1 = pm
  556.     w.C0 = CFrame.new(0, -1.125, -0.1125)
  557.     w.C1 = CFrame.new()
  558.     w.Parent = p
  559.     local p = Instance.new("Part")
  560.     p.Name = "Stock 3"
  561.     p.CanCollide = false
  562.     p.FormFactor = "Custom"
  563.     p.Size = Vector3.new(1, 1, 1)
  564.     p.BrickColor = BrickColor.new("Reddish brown")
  565.     p.Material = "Wood"
  566.     p.Locked = true
  567.     p.TopSurface = 0
  568.     p.BottomSurface = 0
  569.     p.Parent = model
  570.     local m = Instance.new("SpecialMesh")
  571.     m.MeshType = "Brick"
  572.     m.Scale = Vector3.new(0.3, 0.2, 0.668)
  573.     m.Parent = p
  574.     local w = Instance.new("Weld")
  575.     w.Part0 = p
  576.     w.Part1 = pm
  577.     w.C0 = CFrame.new(0, -1.825, -0.5335)
  578.     w.C1 = CFrame.new()
  579.     w.Parent = p
  580.     local p = Instance.new("Part")
  581.     p.Name = "Stock 4"
  582.     p.CanCollide = false
  583.     p.FormFactor = "Custom"
  584.     p.Size = Vector3.new(1, 1, 1)
  585.     p.BrickColor = BrickColor.new("Reddish brown")
  586.     p.Material = "Wood"
  587.     p.Locked = true
  588.     p.TopSurface = 0
  589.     p.BottomSurface = 0
  590.     p.Parent = model
  591.     local m = Instance.new("SpecialMesh")
  592.     m.MeshType = "Brick"
  593.     m.Scale = Vector3.new(0.2, 0.2, 0.8)
  594.     m.Parent = p
  595.     local w = Instance.new("Weld")
  596.     w.Part0 = p
  597.     w.Part1 = pm
  598.     w.C0 = CFrame.new(0, -1.1, -0.735) * CFrame.fromEulerAnglesXYZ(math.rad(10), 0, 0)
  599.     w.C1 = CFrame.new()
  600.     w.Parent = p
  601.     return model
  602. end
  603.  
  604.  
  605. function removeParts(format)
  606.     if format == "RightHand" then
  607.         pcall(function() Player.Character[Name]:Remove() end)
  608.     elseif format == "LeftHand" then
  609.         pcall(function() Player.Character[Name.. " (Left)"]:Remove() end)
  610.     elseif format == "RightHolster" then
  611.         pcall(function() Player.Character[Name.. " (Holstered)"]:Remove() end)
  612.     elseif format == "LeftHolster" then
  613.         pcall(function() Player.Character[Name.. " (Holstered, Left)"]:Remove() end)
  614.     end
  615. end
  616.  
  617.  
  618. function SetAngle(Joint, Angle, Character)
  619.     if Character == nil then return false end
  620.     local Joints = {
  621.         Character.Torso:FindFirstChild("Right Shoulder 2"),
  622.         Character.Torso:FindFirstChild("Left Shoulder 2"),
  623.         Character.Torso:FindFirstChild("Right Hip 2"),
  624.         Character.Torso:FindFirstChild("Left Hip 2")
  625.     }
  626.     if Joints[Joint] == nil then return false end
  627.     if Joint == 1 or Joint == 3 then
  628.         Joints[Joint].DesiredAngle = Angle
  629.     end
  630.     if Joint == 2 or Joint == 4 then
  631.         Joints[Joint].DesiredAngle = -Angle
  632.     end
  633. end
  634.  
  635.  
  636. function ForceAngle(Joint, Angle, Character)
  637.     if Character == nil then return false end
  638.     local Joints = {
  639.         Character.Torso:FindFirstChild("Right Shoulder 2"),
  640.         Character.Torso:FindFirstChild("Left Shoulder 2"),
  641.         Character.Torso:FindFirstChild("Right Hip 2"),
  642.         Character.Torso:FindFirstChild("Left Hip 2")
  643.     }
  644.     if Joints[Joint] == nil then return false end
  645.     if Joint == 1 or Joint == 3 then
  646.         Joints[Joint].DesiredAngle = Angle
  647.         Joints[Joint].CurrentAngle = Angle
  648.     end
  649.     if Joint == 2 or Joint == 4 then
  650.         Joints[Joint].DesiredAngle = -Angle
  651.         Joints[Joint].CurrentAngle = -Angle
  652.     end
  653. end
  654.  
  655.  
  656. function SetSpeed(Joint, Speed, Character)
  657.     if Character == nil then return false end
  658.     local Joints = {
  659.         Character.Torso:FindFirstChild("Right Shoulder 2"),
  660.         Character.Torso:FindFirstChild("Left Shoulder 2"),
  661.         Character.Torso:FindFirstChild("Right Hip 2"),
  662.         Character.Torso:FindFirstChild("Left Hip 2")
  663.     }
  664.     if Joints[Joint] == nil then return false end
  665.     Joints[Joint].MaxVelocity = Speed
  666. end
  667.  
  668.  
  669. function DisableLimb(Limb, Character)
  670.     if Character == nil then return false end
  671.     if Character:FindFirstChild("Torso") == nil then return false end
  672.     local Joints = {
  673.         Character.Torso:FindFirstChild("Right Shoulder"),
  674.         Character.Torso:FindFirstChild("Left Shoulder"),
  675.         Character.Torso:FindFirstChild("Right Hip"),
  676.         Character.Torso:FindFirstChild("Left Hip")
  677.     }
  678.     local Limbs = {
  679.         Character:FindFirstChild("Right Arm"),
  680.         Character:FindFirstChild("Left Arm"),
  681.         Character:FindFirstChild("Right Leg"),
  682.         Character:FindFirstChild("Left Leg")
  683.     }
  684.     if Joints[Limb] == nil then return false end
  685.     if Limbs[Limb] == nil then return false end
  686.     local Joint = Instance.new("Motor")
  687.     Joint.Parent = Character.Torso
  688.     Joint.Part0 = Character.Torso
  689.     Joint.Part1 = Limbs[Limb]
  690.     if Limb == 1 then
  691.         Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  692.         Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  693.         Joint.Name = "Right Shoulder 2"
  694.     elseif Limb == 2 then
  695.         Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  696.         Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  697.         Joint.Name = "Left Shoulder 2"
  698.     elseif Limb == 3 then
  699.         Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  700.         Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  701.         Joint.Name = "Right Hip 2"
  702.     elseif Limb == 4 then
  703.         Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  704.         Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  705.         Joint.Name = "Left Hip 2"
  706.     end
  707.     Joint.MaxVelocity = Joints[Limb].MaxVelocity
  708.     Joint.CurrentAngle = Joints[Limb].CurrentAngle
  709.     Joint.DesiredAngle = Joints[Limb].DesiredAngle
  710.     Joints[Limb]:Remove()
  711. end
  712.  
  713.  
  714. function ResetLimbCFrame(Limb, Character)
  715.     if Character == nil then return false end
  716.     if Character.Parent == nil then return false end
  717.     if Character:FindFirstChild("Torso") == nil then return false end
  718.     local Joints = {
  719.         Character.Torso:FindFirstChild("Right Shoulder 2"),
  720.         Character.Torso:FindFirstChild("Left Shoulder 2"),
  721.         Character.Torso:FindFirstChild("Right Hip 2"),
  722.         Character.Torso:FindFirstChild("Left Hip 2")
  723.     }
  724.     local Limbs = {
  725.         Character:FindFirstChild("Right Arm"),
  726.         Character:FindFirstChild("Left Arm"),
  727.         Character:FindFirstChild("Right Leg"),
  728.         Character:FindFirstChild("Left Leg")
  729.     }
  730.     if Joints[Limb] == nil then return false end
  731.     if Limbs[Limb] == nil then return false end
  732.     if Limb == 1 then
  733.         Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  734.         Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  735.     elseif Limb == 2 then
  736.         Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  737.         Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  738.     elseif Limb == 3 then
  739.         Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  740.         Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  741.     elseif Limb == 4 then
  742.         Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  743.         Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  744.     end
  745. end
  746.  
  747.  
  748. function EnableLimb(Limb, Character)
  749.     if Character == nil then return false end
  750.     if Character:FindFirstChild("Torso") == nil then return false end
  751.     local Joints = {
  752.         Character.Torso:FindFirstChild("Right Shoulder 2"),
  753.         Character.Torso:FindFirstChild("Left Shoulder 2"),
  754.         Character.Torso:FindFirstChild("Right Hip 2"),
  755.         Character.Torso:FindFirstChild("Left Hip 2")
  756.     }
  757.     local Limbs = {
  758.         Character:FindFirstChild("Right Arm"),
  759.         Character:FindFirstChild("Left Arm"),
  760.         Character:FindFirstChild("Right Leg"),
  761.         Character:FindFirstChild("Left Leg")
  762.     }
  763.     if Joints[Limb] == nil then return false end
  764.     if Limbs[Limb] == nil then return false end
  765.     if Limb == 1 then
  766.         Joints[Limb].Name = "Right Shoulder"
  767.     elseif Limb == 2 then
  768.         Joints[Limb].Name = "Left Shoulder"
  769.     elseif Limb == 3 then
  770.         Joints[Limb].Name = "Right Hip"
  771.     elseif Limb == 4 then
  772.         Joints[Limb].Name = "Left Hip"
  773.     end
  774.     Animate = Character:FindFirstChild("Animate")
  775.     if Animate == nil then return false end
  776.     Animate = Animate:Clone()
  777.     Character.Animate:Remove()
  778.     Animate.Parent = Character
  779. end
  780.  
  781.  
  782. function playAnimation(format, mouse)
  783.     if format == "equip" then
  784.         EnableLimb(1, Player.Character)
  785.         EnableLimb(2, Player.Character)
  786.         DisableLimb(2, Player.Character)
  787.         SetSpeed(2, 0.1, Player.Character)
  788.         ForceAngle(2, 0, Player.Character)
  789.         SetAngle(2, math.rad(-50), Player.Character)
  790.         wait(0.25)
  791.         if Player.Character:FindFirstChild(Name.. " (Holstered)") == nil then makeParts("RightHolster") end
  792.         Player.Character[Name.. " (Holstered)"].Handle.Weld:Remove()
  793.         local w = Instance.new("Weld")
  794.         w.Part0 = Player.Character[Name.. " (Holstered)"].Handle
  795.         w.Part1 = Player.Character:FindFirstChild("Left Arm")
  796.         w.C0 = CFrame.new(0.5, -0.25, -0.75) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  797.         w.C1 = CFrame.new() * CFrame.fromEulerAnglesXYZ(math.rad(50), 0, 0)
  798.         w.Parent = Player.Character[Name.. " (Holstered)"].Handle
  799.         SetAngle(2, 0, Player.Character)
  800.         wait(0.25)
  801.         DisableLimb(1, Player.Character)
  802.         ForceAngle(1, 0, Player.Character)
  803.         delay(0.3, function() Player.Character[Name.. " (Holstered)"].Handle.Equip:Play() end)
  804.         for i = 0, 1, 0.05 do
  805.             if Player.Character:FindFirstChild("Torso") ~= nil then
  806.                 if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  807.                     Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  808.                     Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new((-0.5 * i) + (1.5 * (1 - i)), 1.2 * i, 0.8 * i) * CFrame.fromEulerAnglesXYZ(math.rad(300 + ((1 - i) * 50)), math.rad(10), math.rad(-90) * i)
  809.                     Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  810.                     Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new((-0.9 * i) + (-1.5 * (1 - i)), -0.35 * i, 0.51 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(-5 * i), 0)
  811.                     w.C0 = CFrame.new(0.5 - (i * (0.5 * 2)), -0.25 - (i * (-0.25 * 2)), -0.75 - (i * (-0.75 * 2))) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90 + (i * 180)), 0)
  812.                     w.C1 = CFrame.new() * CFrame.fromEulerAnglesXYZ(math.rad(50 - i * 25), 0, -math.rad(i * 15))
  813.                     wait()
  814.                 else return false end
  815.             else return false end
  816.         end
  817.         return playAnimation("hold")
  818.     end
  819.     if format == "unequip" then
  820.         Player.Character[Name].Handle.Weld:Remove()
  821.         local w = Instance.new("Weld")
  822.         w.Part0 = Player.Character[Name].Handle
  823.         w.Part1 = Player.Character:FindFirstChild("Left Arm")
  824.         w.C0 = CFrame.new(0.5, -0.25, -0.75) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  825.         w.C1 = CFrame.new() * CFrame.fromEulerAnglesXYZ(math.rad(50), 0, 0)
  826.         w.Parent = Player.Character[Name].Handle
  827.         for i = 1, 0, -0.05 do
  828.             if Player.Character:FindFirstChild("Torso") ~= nil then
  829.                 if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  830.                     Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  831.                     Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new((-0.5 * i) + (1.5 * (1 - i)), 1.2 * i, 0.8 * i) * CFrame.fromEulerAnglesXYZ(math.rad(300 + ((1 - i) * 50)), math.rad(10), math.rad(-90) * i)
  832.                     Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  833.                     Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new((-0.9 * i) + (-1.5 * (1 - i)), -0.35 * i, 0.51 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(-5 * i), 0)
  834.                     w.C0 = CFrame.new(0.5 - (i * (0.5 * 2)), -0.25 - (i * (-0.25 * 2)), -0.75 - (i * (-0.75 * 2))) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90 + (i * 180)), 0)
  835.                     w.C1 = CFrame.new() * CFrame.fromEulerAnglesXYZ(math.rad(50 - i * 25), 0, -math.rad(i * 15))
  836.                     wait()
  837.                 else return false end
  838.             else return false end
  839.         end
  840.         w.C0 = CFrame.new(0.5, -0.25, -0.75) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  841.         w.C1 = CFrame.new() * CFrame.fromEulerAnglesXYZ(math.rad(50), 0, 0)
  842.         ResetLimbCFrame(1, Player.Character)
  843.         ResetLimbCFrame(2, Player.Character)
  844.         EnableLimb(1, Player.Character)
  845.         EnableLimb(2, Player.Character)
  846.         DisableLimb(2, Player.Character)
  847.         SetSpeed(2, 0.1, Player.Character)
  848.         ForceAngle(2, 0, Player.Character)
  849.         SetAngle(2, math.rad(-50), Player.Character)
  850.         wait(0.25)
  851.         SetAngle(2, 0, Player.Character)
  852.         removeParts("RightHand")
  853.         makeParts("RightHolster")
  854.         wait(0.25)
  855.         makeParts("RightHand")
  856.         removeParts("RightHolster")
  857.         return true
  858.     end
  859.     if format == "hold" then
  860.         if Player.Character:FindFirstChild("Torso") ~= nil then
  861.             if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  862.                 Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  863.                 Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.5, 1.2, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(300), math.rad(10), math.rad(-90))
  864.                 Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  865.                 Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-0.9, -0.35, 0.51) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  866.             else return false end
  867.         else return false end
  868.     end
  869.     if format == "reload" then
  870.         Player.Character[Name].Handle.Reload:Play()
  871.         Player.Character[Name].Magazine.Transparency = 1
  872.         magazineDrop = Player.Character[Name].Magazine:Clone()
  873.         magazineDrop.Transparency = 0
  874.         magazineDrop.Parent = Workspace
  875.         local w = Instance.new("Weld")
  876.         w.Part0 = magazineDrop
  877.         w.Part1 = Player.Character:FindFirstChild("Left Arm")
  878.         w.C0 = CFrame.new(0, 1.1, 0)
  879.         w.C1 = CFrame.new() * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  880.         w.Parent = magazineDrop
  881.         wait(0.2)
  882.         for i = 0, 25, 2.5 do
  883.             if Player.Character:FindFirstChild("Torso") ~= nil then
  884.                 if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  885.                     Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  886.                     Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.5 + (i / 60), 1.2 - (i / 20), 0.8 + (i / 35)) * CFrame.fromEulerAnglesXYZ(math.rad(300 - i), math.rad(10 + -i * 3.5), math.rad(-90))
  887.                     Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  888.                     Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-0.9, -0.35, 0.51) * CFrame.fromEulerAnglesXYZ(math.rad(-90 + i), math.rad(-5), 0)
  889.                     wait()
  890.                 else return false end
  891.             else return false end
  892.         end
  893.         coroutine.resume(coroutine.create(function(part) wait(4.5) for i = 0, 1, 0.1 do part.Transparency = i wait() end part:Remove() end), magazineDrop)
  894.         delay(0.1, function() magazineDrop.CanCollide = true end)
  895.         magazineDrop.Weld:Remove()
  896.         wait(0.05)
  897.         magazineNew = Player.Character[Name].Magazine:Clone()
  898.         magazineNew.Name = "New Magazine"
  899.         magazineNew.Transparency = 0
  900.         magazineNew.Parent = Player.Character[Name]
  901.         local w = Instance.new("Weld")
  902.         w.Part0 = magazineNew
  903.         w.Part1 = Player.Character:FindFirstChild("Left Arm")
  904.         w.C0 = CFrame.new(0, 1.1, 0)
  905.         w.C1 = CFrame.new() * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  906.         w.Parent = magazineNew
  907.         for i = 25, 0, -2.5 do
  908.             if Player.Character:FindFirstChild("Torso") ~= nil then
  909.                 if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  910.                     Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  911.                     Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.5 + ((i + 10) / 60), 1.2 - ((i + 10) / 20), 0.8 + (i / 35)) * CFrame.fromEulerAnglesXYZ(math.rad(300 - (i - 10)), math.rad(10 + -i * 3.5), math.rad(-90))
  912.                     Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  913.                     Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-0.9, -0.35, 0.51) * CFrame.fromEulerAnglesXYZ(math.rad(-90 + i), math.rad(-5), 0)
  914.                     wait()
  915.                 else return false end
  916.             else return false end
  917.         end
  918.         Player.Character[Name].Magazine.Transparency = 0
  919.         Player.Character[Name]["New Magazine"]:Remove()
  920.         Player.Character[Name].Handle.Weld:Remove()
  921.         local w = Instance.new("Weld")
  922.         w.Part0 = Player.Character[Name].Handle
  923.         w.Part1 = Player.Character:FindFirstChild("Left Arm")
  924.         w.C0 = CFrame.new(-0.9, 0, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(10), math.rad(90), 0)
  925.         w.C1 = CFrame.new() * CFrame.fromEulerAnglesXYZ(math.rad(50), 0, 0)
  926.         w.Parent = Player.Character[Name].Handle
  927.         wait(0.3)
  928.         for i = 0, 1, 0.1 do
  929.             if Player.Character:FindFirstChild("Torso") ~= nil then
  930.                 if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  931.                     Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  932.                     Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-0.9 + (i / 10), -0.35 + (i * 1.5), 0.51 + (i / 8)) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  933.                     wait()
  934.                 else return false end
  935.             else return false end
  936.         end
  937.         for i = 0, 1, 0.25 do
  938.             if Player.Character:FindFirstChild("Torso") ~= nil then
  939.                 if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  940.                     Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  941.                     Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-0.8, 1.15 - (i / 5), 0.635) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  942.                     wait()
  943.                 else return false end
  944.             else return false end
  945.         end
  946.         for i = 1, 0, -0.25 do
  947.             if Player.Character:FindFirstChild("Torso") ~= nil then
  948.                 if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  949.                     Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  950.                     Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-0.8, 1.15 - (i / 5), 0.635) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  951.                     wait()
  952.                 else return false end
  953.             else return false end
  954.         end
  955.         for i = 1, 0, -0.1 do
  956.             if Player.Character:FindFirstChild("Torso") ~= nil then
  957.                 if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  958.                     Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  959.                     Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-0.9 + (i / 10), -0.35 + (i * 1.5), 0.51 + (i / 8)) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  960.                     wait()
  961.                 else return false end
  962.             else return false end
  963.         end
  964.         removeParts("RightHand")
  965.         makeParts("RightHand")
  966.         playAnimation("hold")
  967.         return true
  968.     end
  969.     if format == "fire" then
  970.         makeShell(Player.Character[Name]:FindFirstChild("ShellOut"))
  971.         if Player.Character[Name]:FindFirstChild("Handle") ~= nil then
  972.             Player.Character[Name].Handle.Fire:Stop()
  973.             Player.Character[Name].Handle.Fire.Volume = math.random(3, 4) / 10
  974.             Player.Character[Name].Handle.Fire.Pitch = math.random(69, 71) / 10
  975.             Player.Character[Name].Handle.Fire:Play()
  976.             coroutine.resume(coroutine.create(function() for i = 0.5, 0, -0.075 do Player.Character[Name].Handle.Fire.Volume = i wait() end Player.Character[Name].Handle.Fire.Volume = 0 end))
  977.             CamShake(5, 50000)
  978.         else return false end
  979.         if Player.Character[Name]:FindFirstChild("Muzzle") ~= nil then
  980.             coroutine.resume(coroutine.create(function() Player.Character[Name].Muzzle.Smoke.Enabled = true Player.Character[Name].Muzzle.Fire.Enabled = true wait(0.1) Player.Character[Name].Muzzle.Smoke.Enabled = false Player.Character[Name].Muzzle.Fire.Enabled = false end))
  981.         else return false end
  982.         for i = 0, 10, 5 do
  983.             if Player.Character:FindFirstChild("Torso") ~= nil then
  984.                 if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  985.                     Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  986.                     Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.5, 1.2, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(300), math.rad(10 + i), math.rad(-90))
  987.                     Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  988.                     Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-0.9, -0.35, 0.51) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
  989.                     wait()
  990.                 else return false end
  991.             else return false end
  992.         end
  993.         for i = 10, 0, -5 do
  994.             if Player.Character:FindFirstChild("Torso") ~= nil then
  995.                 if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  996.                     Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  997.                     Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.5, 1.2, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(300), math.rad(10 + i), math.rad(-90))
  998.                     Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  999.                     Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-0.9, -0.35, 0.51) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
  1000.                     wait()
  1001.                 else return false end
  1002.             else return false end
  1003.         end
  1004.     end
  1005.     return true
  1006. end
  1007.  
  1008.  
  1009. function CamShake(time, freq)
  1010.     coroutine.resume(coroutine.create(function()
  1011.         local cam = Workspace.CurrentCamera
  1012.         local time = 10
  1013.         local seed = Vector3.new(math.random(100, 200) / freq, math.random(100, 200) / freq, 0)
  1014.         if math.random(1, 2) == 1 then seed = Vector3.new(-seed.x, seed.y, 0) end
  1015.         if math.random(1, 2) == 1 then seed = Vector3.new(seed.x, -seed.y, 0) end
  1016.         cam.CoordinateFrame = (CFrame.new(cam.Focus.p) * (cam.CoordinateFrame - cam.CoordinateFrame.p) * CFrame.fromEulerAnglesXYZ(seed.x * time, seed.y * time, 0)) * CFrame.new(0, 0, (cam.CoordinateFrame.p - cam.Focus.p).magnitude)
  1017.         for i = 1, time do
  1018.             cam.CoordinateFrame = (CFrame.new(cam.Focus.p) * (cam.CoordinateFrame - cam.CoordinateFrame.p) * CFrame.fromEulerAnglesXYZ(-seed.x, -seed.y, 0)) * CFrame.new(0, 0, (cam.CoordinateFrame.p - cam.Focus.p).magnitude)
  1019.             wait()
  1020.         end
  1021.     end))
  1022. end
  1023.  
  1024.  
  1025. function makeShell(part)
  1026.     if part == nil then return false end
  1027.     local casing = Instance.new("Part")
  1028.     casing.Name = "Shell"
  1029.     casing.FormFactor = "Custom"
  1030.     casing.Size = Vector3.new(1, 1, 1)
  1031.     casing.CFrame = CFrame.new(part.Position) * CFrame.fromEulerAnglesXYZ(math.rad(math.random(0, 360)), math.rad(math.random(0, 360)), math.rad(math.random(0, 360)))
  1032.     casing.BrickColor = BrickColor.new("New Yeller")
  1033.     local mesh = Instance.new("CylinderMesh")
  1034.     mesh.Scale = Vector3.new(0.1, 0.3, 0.1)
  1035.     mesh.Parent = casing
  1036.     casing.Parent = Workspace
  1037.     casing:BreakJoints()
  1038.     casing.Velocity = (part.CFrame.lookVector * 50) + Vector3.new(0, 10, 0)
  1039.     coroutine.resume(coroutine.create(function() wait(4.5) for i = 0, 1, 0.1 do casing.Transparency = i wait() end casing:Remove() end))
  1040. end
  1041.  
  1042.  
  1043. function Weld(x, y)
  1044.     local weld = Instance.new("Weld")
  1045.     weld.Part0 = x
  1046.     weld.Part1 = y
  1047.     CJ = CFrame.new(x.Position)
  1048.     C0 = x.CFrame:inverse() * CJ
  1049.     C1 = y.CFrame:inverse() * CJ
  1050.     weld.C0 = C0
  1051.     weld.C1 = C1
  1052.     weld.Parent = x
  1053. end
  1054.  
  1055.  
  1056. function tagHumanoid(humanoid)
  1057.     local tag = Instance.new("ObjectValue")
  1058.     tag.Name = "creator"
  1059.     tag.Value = Player
  1060.     tag.Parent = humanoid
  1061.     local tag = Instance.new("StringValue")
  1062.     tag.Name = "creatorType1"
  1063.     tag.Value = Name
  1064.     tag.Parent = humanoid
  1065.     local tag = Instance.new("StringValue")
  1066.     tag.Name = "creatorType2"
  1067.     tag.Value = "sniped"
  1068.     tag.Parent = humanoid
  1069. end
  1070.  
  1071.  
  1072. function untagHumanoid(humanoid)
  1073.     if humanoid ~= nil then
  1074.         local tag = humanoid:FindFirstChild("creator")
  1075.         if tag ~= nil then
  1076.             tag:Remove()
  1077.         end
  1078.         local tag = humanoid:FindFirstChild("creatorType1")
  1079.         if tag ~= nil then
  1080.             tag:Remove()
  1081.         end
  1082.         local tag = humanoid:FindFirstChild("creatorType2")
  1083.         if tag ~= nil then
  1084.             tag:Remove()
  1085.         end
  1086.     end
  1087. end
  1088.  
  1089.  
  1090. function fire(startPoint, endPoint, hit)
  1091.     local trail = Instance.new("Part")
  1092.     trail.Name = "Bullet Trail"
  1093.     trail.BrickColor = BrickColor.new("New Yeller")
  1094.     trail.TopSurface = 0
  1095.     trail.BottomSurface = 0
  1096.     trail.FormFactor = 0
  1097.     trail.Size = Vector3.new(1, 1, 1)
  1098.     trail.Transparency = 0.3
  1099.     trail.Anchored = true
  1100.     trail.CanCollide = false
  1101.     trail.CFrame = CFrame.new((startPoint + endPoint) / 2, endPoint)
  1102.     trail.Parent = Workspace
  1103.     local mesh = Instance.new("SpecialMesh")
  1104.     mesh.MeshType = "Brick"
  1105.     mesh.Scale = Vector3.new(0.1, 0.1, (startPoint - endPoint).magnitude)
  1106.     mesh.Parent = trail
  1107.     coroutine.resume(coroutine.create(function(part) for i = 1, 10 do part.Mesh.Scale = Vector3.new(part.Mesh.Scale.x - 0.01, part.Mesh.Scale.y - 0.01, part.Mesh.Scale.z) wait() end part:Remove() end), trail)
  1108.     if hit ~= nil then
  1109.         if hit.Parent == nil then return end
  1110.         if hit.Parent:FindFirstChild("Humanoid") ~= nil then
  1111.             tagHumanoid(hit.Parent.Humanoid)
  1112.             if hit.Name == "Head" then
  1113.                 hit.Parent.Humanoid:TakeDamage(damage * 10)
  1114.                 local s = Instance.new("Sound", hit)
  1115.                 s.SoundId = "http://www.roblox.com/Asset/?id=1876552"
  1116.                 s:Play()
  1117.                 local s = s:Clone(Player.Character.Torso)
  1118.                 s:Play()
  1119.                 coroutine.resume(coroutine.create(function()
  1120.                     while true do
  1121.                         if hit.Parent == nil then break end
  1122.                         if hit.Parent.Parent == nil then break end
  1123.                         hit:BreakJoints()
  1124.                         wait()
  1125.                     end
  1126.                 end))
  1127.             elseif hit.Name == "Torso" then
  1128.                 hit.Parent.Humanoid:TakeDamage(damage * 2)
  1129.             else
  1130.                 hit.Parent.Humanoid:TakeDamage(damage)
  1131.             end
  1132.             if math.random(1, 10) == 1 then
  1133.                 hit.Parent.Humanoid.Sit = true
  1134.             end
  1135.             delay(0.1, function() untagHumanoid(hit.Parent.Humanoid) end)
  1136.         end
  1137.         if hit.Anchored == false then
  1138.             hit.Velocity = hit.Velocity + ((endPoint - startPoint).unit * (damage * 2))
  1139.         end
  1140.     end
  1141. end
  1142.  
  1143.  
  1144. function onButton1Down(mouse)
  1145.     if selected == false then return end
  1146.     if Player.Character:FindFirstChild(Name) ~= nil and Button1Down == false and canFire == true and (function() if dual == true then if Player.Character:FindFirstChild(Name.. " (Left)") ~= nil then return true else return false end else return true end end)() == true then
  1147.         if Player.Character[Name]:FindFirstChild("Handle") == nil then return end
  1148.         if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  1149.         if dual == true then if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") == nil then return end end
  1150.         if dual == true then if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end end
  1151.         mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  1152.         Button1Down = true
  1153.         canFire = false
  1154.         canFire2 = true
  1155.         while canFire2 == true do
  1156.             local humanoid = Player.Character:FindFirstChild("Humanoid")
  1157.             if humanoid == nil then
  1158.                 canFire2 = false
  1159.                 break
  1160.             end
  1161.             if humanoid.Health <= 0 then
  1162.                 canFire2 = false
  1163.                 break
  1164.             end
  1165.             local fireLeft = false
  1166.             if automatic == false and burst == false then
  1167.                 canFire2 = false
  1168.             elseif automatic == false and burst == true then
  1169.                 if burstCount >= burstCountMax then
  1170.                     canFire2 = false
  1171.                     burstCount = 0
  1172.                     break
  1173.                 end
  1174.                 burstCount = burstCount + 1
  1175.             elseif automatic == true and burst == false then
  1176.                 fireLeft = true
  1177.             end
  1178.             if magazine.Value > 0 then
  1179.                 magazine.Value = magazine.Value - 1
  1180.                 updateGui()
  1181.                 fire(Player.Character[Name].Muzzle.Position, mouse.Hit.p, mouse.Target)
  1182.                 coroutine.resume(coroutine.create(function()
  1183.                     if dual == true then
  1184.                         playAnimation("rightFire")
  1185.                     elseif dual == false then
  1186.                         playAnimation("fire")
  1187.                     end
  1188.                 end))
  1189.             else
  1190.                 Player.Character[Name].Handle.Empty:Play()
  1191.             end
  1192.             if fireLeft == true and dual == true and automatic == true then
  1193.                 if magazine.Value > 0 then
  1194.                     coroutine.resume(coroutine.create(function()
  1195.                         wait(readyTime / 2)
  1196.                         magazine.Value = magazine.Value - 1
  1197.                         updateGui()
  1198.                         fire(Player.Character[Name.. " (Left)"].Muzzle.Position, mouse.Hit.p, mouse.Target)
  1199.                         playAnimation("leftFire")
  1200.                     end))
  1201.                 else
  1202.                     coroutine.resume(coroutine.create(function()
  1203.                         wait(readyTime / 2)
  1204.                         Player.Character[Name].Handle.Empty:Play()
  1205.                     end))
  1206.                 end
  1207.             end
  1208.             wait(readyTime)
  1209.         end
  1210.         mouse.Icon = "rbxasset://textures\\GunCursor.png"
  1211.         canFire = true
  1212.     end
  1213. end
  1214.  
  1215.  
  1216. function onButton1Up(mouse)
  1217.     if selected == false then return end
  1218.     Button1Down = false
  1219.     canFire2 = false
  1220.     burstCount = 0
  1221.     while canFire == false do wait() end
  1222.     if dual == true and automatic == false then
  1223.         if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") == nil then return end
  1224.         if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
  1225.         mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  1226.         canFire = false
  1227.         canFire2 = true
  1228.         while canFire2 == true do
  1229.             local humanoid = Player.Character:FindFirstChild("Humanoid")
  1230.             if humanoid == nil then
  1231.                 canFire2 = false
  1232.                 break
  1233.             end
  1234.             if humanoid.Health <= 0 then
  1235.                 canFire2 = false
  1236.                 break
  1237.             end
  1238.             if burst == false then
  1239.                 canFire2 = false
  1240.             elseif burst == true then
  1241.                 if burstCount >= burstCountMax then
  1242.                     canFire2 = false
  1243.                     burstCount = 0
  1244.                     break
  1245.                 end
  1246.                 burstCount = burstCount + 1
  1247.             end
  1248.             if magazine.Value <= 0 then
  1249.                 Player.Character[Name].Handle.Empty:Play()
  1250.             else
  1251.                 coroutine.resume(coroutine.create(function()
  1252.                     playAnimation("leftFire")
  1253.                 end))
  1254.                 magazine.Value = magazine.Value - 1
  1255.                 updateGui()
  1256.                 fire(Player.Character[Name.. " (Left)"].Muzzle.Position, mouse.Hit.p, mouse.Target)
  1257.             end
  1258.             wait(readyTime)
  1259.         end
  1260.         mouse.Icon = "rbxasset://textures\\GunCursor.png"
  1261.         canFire = true
  1262.     end
  1263. end
  1264.  
  1265.  
  1266. function onKeyDown(key, mouse)
  1267.     if selected == false then return end
  1268.     key = key:lower()
  1269.     if key == "q" and Button1Down == false and canFire == true then
  1270.         if mouse.Target == nil then return end
  1271.         if game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent) ~= nil then
  1272.             if dual == true then onKeyDown("t", mouse) end
  1273.             onDeselected(mouse)
  1274.             removeParts("RightHolster")
  1275.             script.Parent.Parent = game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent).Backpack
  1276.         end
  1277.     end
  1278.     if key == "e" and Button1Down == false and canFire == true and canSilence == true then
  1279.         if silenced then
  1280.             silenced = false
  1281.             if Player.Character:FindFirstChild(Name) == nil then return end
  1282.             if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  1283.             if Player.Character[Name]:FindFirstChild("Muzzle 2") == nil then return end
  1284.             Player.Character[Name].Muzzle.Transparency = 1
  1285.             Player.Character[Name].Muzzle.Name = "Silencer"
  1286.             Player.Character[Name]["Muzzle 2"].Name = "Muzzle"
  1287.             if dual == true then
  1288.                 if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
  1289.                 if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle 2") == nil then return end
  1290.                 Player.Character[Name.. " (Left)"].Muzzle.Transparency = 1
  1291.                 Player.Character[Name.. " (Left)"].Muzzle.Name = "Silencer"
  1292.                 Player.Character[Name.. " (Left)"]["Muzzle 2"].Name = "Muzzle"
  1293.             end
  1294.         else
  1295.             silenced = true
  1296.             if Player.Character:FindFirstChild(Name) == nil then return end
  1297.             if Player.Character[Name]:FindFirstChild("Silencer") == nil then return end
  1298.             if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  1299.             Player.Character[Name].Silencer.Transparency = 0
  1300.             Player.Character[Name].Muzzle.Name = "Muzzle 2"
  1301.             Player.Character[Name].Silencer.Name = "Muzzle"
  1302.             if dual == true then
  1303.                 if Player.Character[Name.. " (Left)"]:FindFirstChild("Silencer") == nil then return end
  1304.                 if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
  1305.                 Player.Character[Name.. " (Left)"].Silencer.Transparency = 0
  1306.                 Player.Character[Name.. " (Left)"].Muzzle.Name = "Muzzle 2"
  1307.                 Player.Character[Name.. " (Left)"].Silencer.Name = "Muzzle"
  1308.             end
  1309.         end
  1310.     end
  1311.     if key == "r" and Button1Down == false and canFire == true then
  1312.         if ammo.Value > 0 and magazine.Value ~= magazineMax.Value then
  1313.             canFire = false
  1314.             burstCount = 0
  1315.             mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  1316.             if magazine.Value > 0 then ammo.Value = ammo.Value + magazine.Value magazine.Value = 0 end
  1317.             updateGui()
  1318.             if dual == true then
  1319.                 playAnimation("reloadDual")
  1320.             elseif dual == false then
  1321.                 playAnimation("reload")
  1322.             end
  1323.             if ammo.Value - magazineMax.Value < 0 then
  1324.                 magazine.Value = ammo.Value
  1325.                 ammo.Value = 0
  1326.             elseif ammo.Value - magazineMax.Value >= 0 then
  1327.                 ammo.Value = ammo.Value - magazineMax.Value
  1328.                 magazine.Value = magazineMax.Value
  1329.             end
  1330.             updateGui()
  1331.             mouse.Icon = "rbxasset://textures\\GunCursor.png"
  1332.             canFire = true
  1333.         end
  1334.     end
  1335.     if key == "t" and Button1Down == false and canFire == true and canDual == true then
  1336.         canFire = false
  1337.         if dual == false then
  1338.             local weapon = nil
  1339.             for _, p in pairs(Player.Backpack:GetChildren()) do
  1340.                 if p.Name == Name and p ~= script.Parent then weapon = p break end
  1341.             end
  1342.             if weapon ~= nil then
  1343.                 dual = true
  1344.                 weapon.Name = "Dual"
  1345.                 weapon.Parent = script
  1346.                 silenced = false
  1347.                 removeParts("RightHand")
  1348.                 makeParts("RightHand")
  1349.                 removeParts("RightHolster")
  1350.                 makeParts("LeftHolster")
  1351.                 playAnimation("leftEquip")
  1352.                 removeParts("LeftHolster")
  1353.                 makeParts("LeftHand")
  1354.                 magazineMax.Value = math.ceil(magazineMax.Value * 2)
  1355.                 ammoMax.Value = math.ceil(ammoMax.Value * 2)
  1356.                 magazine.Value = magazine.Value + weapon.Magazine.Value
  1357.                 ammo.Value = ammo.Value + weapon.Ammo.Value
  1358.                 updateGui()
  1359.             end
  1360.         elseif dual == true then
  1361.             local weapon = script:FindFirstChild("Dual")
  1362.             if weapon ~= nil then
  1363.                 dual = false
  1364.                 weapon.Name = Name
  1365.                 weapon.Parent = Player.Backpack
  1366.                 silenced = false
  1367.                 removeParts("RightHand")
  1368.                 makeParts("RightHand")
  1369.                 playAnimation("leftUnequip")
  1370.                 removeParts("LeftHand")
  1371.                 makeParts("RightHolster")
  1372.                 playAnimation("hold")
  1373.                 weapon.Magazine.Value = math.floor(magazine.Value / 2)
  1374.                 weapon.Ammo.Value = math.floor(ammo.Value / 2)
  1375.                 magazineMax.Value = math.ceil(magazineMax.Value / 2)
  1376.                 ammoMax.Value = math.ceil(ammoMax.Value / 2)
  1377.                 magazine.Value = math.ceil(magazine.Value / 2)
  1378.                 ammo.Value = math.ceil(ammo.Value / 2)
  1379.                 updateGui()
  1380.             end
  1381.         end
  1382.         canFire = true
  1383.     end
  1384.     if key == "y" and canZoom == true then
  1385.         if zoom == false then
  1386.             zoom = true
  1387.             local pos = mouse.Hit.p
  1388.             local target = mouse.Target
  1389.             local cam = Workspace.CurrentCamera
  1390.             focus = Instance.new("Part", Workspace)
  1391.             focus.Anchored = true
  1392.             focus.CanCollide = false
  1393.             focus.Transparency = 1
  1394.             focus.TopSurface = 0
  1395.             focus.BottomSurface = 0
  1396.             focus.FormFactor = "Plate"
  1397.             focus.Size = Vector3.new(0, 0, 0)
  1398.             focus.CFrame = CFrame.new(pos) * (CFrame.new(Player.Character.Torso.Position, pos) - CFrame.new(Player.Character.Torso.Position, pos).p)
  1399.             cam.CameraSubject = focus
  1400.             cam.CameraType = "Attach"
  1401.             while zoom == true and selected == true do
  1402.                 local set = false
  1403.                 if target ~= nil then
  1404.                     if target.Parent ~= nil then
  1405.                         if target.Anchored == false then
  1406.                             focus.CFrame = CFrame.new(target.Position) * (CFrame.new(Player.Character.Torso.Position, target.Position) - CFrame.new(Player.Character.Torso.Position, target.Position).p)
  1407.                             set = true
  1408.                         end
  1409.                     end
  1410.                 end
  1411.                 if set == false then
  1412.                     focus.CFrame = CFrame.new(pos) * (CFrame.new(Player.Character.Torso.Position, pos) - CFrame.new(Player.Character.Torso.Position, pos).p)
  1413.                 end
  1414.                 wait()
  1415.             end
  1416.             if focus ~= nil then focus:Remove() focus = nil end
  1417.             local cam = Workspace.CurrentCamera
  1418.             cam.CameraSubject = Player.Character:FindFirstChild("Humanoid")
  1419.             cam.CameraType = "Custom"
  1420.         else
  1421.             zoom = false
  1422.         end
  1423.     end
  1424.     if key == "u" and Button1Down == false and canFire == true then
  1425.         if automatic == false and burst == false then
  1426.             if switchToBurst == true then
  1427.                 burst = true
  1428.                 local m = Instance.new("Message", Player)
  1429.                 m.Text = "Burst"
  1430.                 pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1431.                 delay(2.5, function() m:Remove() end)
  1432.             elseif switchToAutomatic == true then
  1433.                 automatic = true
  1434.                 local m = Instance.new("Message", Player)
  1435.                 m.Text = "Automatic"
  1436.                 pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1437.                 delay(2.5, function() m:Remove() end)
  1438.             end
  1439.         elseif automatic == false and burst == true then
  1440.             if switchToAutomatic == true then
  1441.                 automatic = true
  1442.                 burst = false
  1443.                 local m = Instance.new("Message", Player)
  1444.                 m.Text = "Automatic"
  1445.                 pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1446.                 delay(2.5, function() m:Remove() end)
  1447.             elseif switchToSingle == true then
  1448.                 burst = false
  1449.                 local m = Instance.new("Message", Player)
  1450.                 m.Text = "Single"
  1451.                 pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1452.                 delay(2.5, function() m:Remove() end)
  1453.             end
  1454.         elseif automatic == true and burst == false then
  1455.             if switchToSingle == true then
  1456.                 automatic = false
  1457.                 local m = Instance.new("Message", Player)
  1458.                 m.Text = "Single"
  1459.                 pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1460.                 delay(2.5, function() m:Remove() end)
  1461.             elseif switchToBurst == true then
  1462.                 automatic = false
  1463.                 burst = true
  1464.                 local m = Instance.new("Message", Player)
  1465.                 m.Text = "Burst"
  1466.                 pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1467.                 delay(2.5, function() m:Remove() end)
  1468.             end
  1469.         end
  1470.     end
  1471. end
  1472.  
  1473.  
  1474. function onSelected(mouse)
  1475.     if selected == true then return end
  1476.     selected = true
  1477.     canFire = false
  1478.     mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  1479.     while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  1480.         if Player.Character.WeaponActivated.Value == nil then break end
  1481.         if Player.Character.WeaponActivated.Value.Parent == nil then break end
  1482.         wait()
  1483.     end
  1484.     updateGui()
  1485.     local weapon = Instance.new("ObjectValue")
  1486.     weapon.Name = "WeaponActivated"
  1487.     weapon.Value = script.Parent
  1488.     weapon.Parent = Player.Character
  1489.     DisableLimb(1, Player.Character)
  1490.     DisableLimb(2, Player.Character)
  1491.     ForceAngle(1, 0, Player.Character)
  1492.     ForceAngle(2, 0, Player.Character)
  1493.     if dual == true then
  1494.         coroutine.resume(coroutine.create(function() playAnimation("leftEquip") end))
  1495.         playAnimation("rightEquip")
  1496.         removeParts("LeftHolster")
  1497.         makeParts("LeftHand")
  1498.     else
  1499.         playAnimation("equip")
  1500.     end
  1501.     removeParts("RightHolster")
  1502.     makeParts("RightHand")
  1503.     mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  1504.     mouse.Button1Up:connect(function() onButton1Up(mouse) end)
  1505.     mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)
  1506.     mouse.Icon = "rbxasset://textures\\GunCursor.png"
  1507.     canFire = true
  1508. end
  1509.  
  1510.  
  1511. function onDeselected(mouse)
  1512.     if selected == false then return end
  1513.     Button1Down = false
  1514.     while canFire == false do
  1515.         wait()
  1516.     end
  1517.     selected = false
  1518.     if dual == true then
  1519.         if math.random(1, 2) == 1 then
  1520.             coroutine.resume(coroutine.create(function() playAnimation("leftUnequip") end))
  1521.             wait(math.random(1, 10) / 10)
  1522.             playAnimation("rightUnequip")
  1523.         else
  1524.             coroutine.resume(coroutine.create(function() playAnimation("rightUnequip") end))
  1525.             wait(math.random(1, 10) / 10)
  1526.             playAnimation("leftUnequip")
  1527.         end
  1528.         removeParts("LeftHand")
  1529.         makeParts("LeftHolster")
  1530.     else
  1531.         playAnimation("unequip")
  1532.     end
  1533.     removeParts("RightHand")
  1534.     makeParts("RightHolster")
  1535.     ForceAngle(1, 0, Player.Character)
  1536.     ForceAngle(2, 0, Player.Character)
  1537.     ResetLimbCFrame(1, Player.Character)
  1538.     ResetLimbCFrame(2, Player.Character)
  1539.     EnableLimb(1, Player.Character)
  1540.     EnableLimb(2, Player.Character)
  1541.     silenced = false
  1542.     if Player.PlayerGui:FindFirstChild(Name) ~= nil then Player.PlayerGui[Name]:Remove() end
  1543.     if Player.Character:FindFirstChild("WeaponActivated") ~= nil then
  1544.         if Player.Character.WeaponActivated.Value == script.Parent then
  1545.             Player.Character.WeaponActivated:Remove()
  1546.         end
  1547.     end
  1548.     while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  1549.         if Player.Character.WeaponActivated.Value == nil then break end
  1550.         if Player.Character.WeaponActivated.Value.Parent == nil then break end
  1551.         wait()
  1552.     end
  1553. end
  1554.  
  1555.  
  1556. if script.Parent.ClassName ~= "HopperBin" then
  1557.     if Player == nil then print("Error: Player not found!") return end
  1558.     Tool = Instance.new("HopperBin")
  1559.     Tool.Name = Name
  1560.     Tool.Parent = Player.Backpack
  1561.     script.Name = "Main"
  1562.     script.Parent = Tool
  1563. end wait() if script.Parent.ClassName == "HopperBin" then
  1564.     while script.Parent.Parent.ClassName ~= "Backpack" do
  1565.         wait()
  1566.     end
  1567.     if script.Parent:FindFirstChild("MagazineMax") == nil then
  1568.         magazineMax = Instance.new("NumberValue")
  1569.         magazineMax.Name = "MagazineMax"
  1570.         magazineMax.Value = 10
  1571.         magazineMax.Parent = script.Parent
  1572.     else
  1573.         magazineMax = script.Parent.MagazineMax
  1574.     end
  1575.     if script.Parent:FindFirstChild("Magazine") == nil then
  1576.         magazine = Instance.new("NumberValue")
  1577.         magazine.Name = "Magazine"
  1578.         magazine.Value = 0
  1579.         magazine.Parent = script.Parent
  1580.     else
  1581.         magazine = script.Parent.Magazine
  1582.     end
  1583.     if script.Parent:FindFirstChild("AmmoMax") == nil then
  1584.         ammoMax = Instance.new("NumberValue")
  1585.         ammoMax.Name = "AmmoMax"
  1586.         ammoMax.Value = 260
  1587.         ammoMax.Parent = script.Parent
  1588.     else
  1589.         ammoMax = script.Parent.AmmoMax
  1590.     end
  1591.     if script.Parent:FindFirstChild("Ammo") == nil then
  1592.         ammo = Instance.new("NumberValue")
  1593.         ammo.Name = "Ammo"
  1594.         ammo.Value = script.Parent.AmmoMax.Value
  1595.         ammo.Parent = script.Parent
  1596.     else
  1597.         ammo = script.Parent.Ammo
  1598.     end
  1599.     Player = script.Parent.Parent.Parent
  1600.     makeParts("RightHolster")
  1601.     script.Parent.Selected:connect(onSelected)
  1602.     script.Parent.Deselected:connect(onDeselected)
  1603. end
  1604. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement