Facebook
From Billwa, 9 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 416
  1. ak47 = Instance.new("Tool")
  2. ak47.Parent = game.Players.meunumbertwo.Backpack
  3. ak47.GripPos = Vector3.new(-0,-0.10000000149012,0.69999998807907)
  4. ak47.Grip = CFrame.new(-0,-0.10000000149012,0.69999998807907) * CFrame.Angles(-9.9999997171807e-010, -1.0000000133514e-010, 1.0000912714276e-015)
  5. ak47.GripForward = Vector3.new(1.0000000133514e-010,-9.9999997171807e-010,-1)
  6. ak47.Name = "AK47"
  7. ak47.GripRight = Vector3.new(1,1.0001912213153e-015,1.0000000133514e-010)
  8. ak47.GripUp = Vector3.new(-1.0000912714276e-015,1,-9.9999997171807e-010)
  9.  
  10. handle = Instance.new("Part",ak47)
  11. handle.FormFactor = Enum.FormFactor.Plate
  12. handle.TopSurface = Enum.SurfaceType.Smooth
  13. handle.Size = Vector3.new(1,2,5)
  14. handle.Name = "Handle"
  15. handle.CFrame = CFrame.new(-25.213916778564,0.48495537042618,-61.464176177979) * CFrame.Angles(-0.024566793814301, -1.4979313611984, 1.5458176136017)
  16. handle.BrickColor = BrickColor.new("Black")
  17. handle.Friction = 0.30000001192093
  18. handle.BottomSurface = Enum.SurfaceType.Smooth
  19.  
  20. mesh = Instance.new("SpecialMesh",handle)
  21. mesh.Scale = Vector3.new(2,1.5,1.5)
  22. mesh.MeshId = "http://www.roblox.com/asset/?id=3824749"
  23. mesh.TextureId = "http://www.roblox.com/asset/?id=3824746"
  24. mesh.VertexColor = Vector3.new(0.40000000596046,0.40000000596046,0.40000000596046)
  25. mesh.MeshType = Enum.MeshType.FileMesh
  26.  
  27. m1 = Instance.new("Sound",ak47,Handle)
  28. m1.Pitch = 0.75
  29. m1.Name = "Fire"
  30. m1.Volume = 1
  31. m1.SoundId = "http://roblox.com/asset/?id=139711658"
  32.  
  33. Tool = ak47;
  34. local arms = nil
  35. local torso = nil
  36. local welds = {}
  37.  
  38. function Equip(mouse)
  39. wait(0.01)
  40. arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
  41. torso = Tool.Parent:FindFirstChild("Torso")
  42. if arms ~= nil and torso ~= nil then
  43. local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
  44. if sh ~= nil then
  45. local yes = true
  46. if yes then
  47. yes = false
  48. sh[1].Part1 = nil
  49. sh[2].Part1 = nil
  50. local weld1 = Instance.new("Weld")
  51. weld1.Part0 = torso
  52. weld1.Parent = torso
  53. weld1.Part1 = arms[1]
  54. weld1.C1 = CFrame.new(-0.249, 1.35, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
  55. welds[1] = weld1
  56. local weld2 = Instance.new("Weld")
  57. weld2.Part0 = torso
  58. weld2.Parent = torso
  59. weld2.Part1 = arms[2]
  60. weld2.C1 = CFrame.new(-1, -0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
  61. welds[2] = weld2
  62. end
  63. else
  64. print("sh")
  65. end
  66. else
  67. print("arms")
  68. end
  69. end
  70.  
  71. function Unequip(mouse)
  72. if arms ~= nil and torso ~= nil then
  73. local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
  74. if sh ~= nil then
  75. local yes = true
  76. if yes then
  77. yes = false
  78. sh[1].Part1 = arms[1]
  79. sh[2].Part1 = arms[2]
  80. welds[1].Parent = nil
  81. welds[2].Parent = nil
  82. end
  83. else
  84. print("sh")
  85. end
  86. else
  87. print("arms")
  88. end
  89. end
  90. Tool.Equipped:connect(Equip)
  91. Tool.Unequipped:connect(Unequip)
  92.  
  93. local Tool = ak47;
  94.  
  95. enabled = true
  96. function onButton1Down(mouse)
  97.         if not enabled then
  98.                 return
  99.         end
  100.  
  101.         enabled = true
  102.         mouse.Icon = "rbxasset://textures\\GunCursor.png"
  103.  
  104.         --wait(.5)
  105.         --mouse.Icon = "rbxasset://textures\\GunCursor.png"
  106.         --enabled = true
  107.         --mouse.Button1Up:connect(function() onButton1Up(mouse) end)
  108.  
  109. end
  110.  
  111.  
  112. function onButton1Up(mouse)
  113. enabled = false
  114. Tool.Enabled = false
  115. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  116. wait(1)
  117. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  118. enabled = true
  119. Tool.Enabled = true
  120. end
  121.  
  122. function onEquippedLocal(mouse)
  123.  
  124.         if mouse == nil then
  125.                 print("Mouse not found")
  126.                 return
  127.         end
  128.  
  129.         mouse.Icon = "rbxasset://textures\\GunCursor.png"
  130.         mouse.Button1Down:connect(function() onButton1Down(mouse) end) 
  131.         mouse.Button1Up:connect(function() onButton1Up(mouse)end)
  132. end
  133.  
  134.  
  135. Tool.Equipped:connect(onEquippedLocal)
  136.  
  137. Tool = ak47
  138.  
  139. colors = {2, 0, 0}
  140.  
  141. function fire(v)
  142.  
  143.         Tool.Handle.Fire:play()
  144.        
  145.  
  146.         local vCharacter = Tool.Parent
  147.         local vPlayer = game.Players:playerFromCharacter(vCharacter)
  148.  
  149.         local missile = Instance.new("Part")
  150.  
  151.        
  152.  
  153.         local spawnPos = vCharacter.PrimaryPart.Position
  154.        
  155.  
  156.  
  157.         spawnPos  = spawnPos + (v * 8)
  158.  
  159.         missile.Position = spawnPos
  160.         missile.Size = Vector3.new(1,1,1)
  161.         missile.Velocity = v * 900
  162.         missile.BrickColor = BrickColor.new(colors[math.random(1, #colors)])
  163.         missile.Shape = 0
  164.         missile.BottomSurface = 0
  165.         missile.TopSurface = 0
  166.         missile.Name = "Paintball"
  167.         missile.Elasticity = 0
  168.         missile.Reflectance = 0
  169.         missile.Friction = .3
  170.  
  171.         local force = Instance.new("BodyForce")
  172.         force.force = Vector3.new(0,100,0)
  173.         force.Parent = missile
  174.        
  175.         Tool.BrickCleanup:clone().Parent = missile
  176.  
  177.         local new_script = script.Parent.Paintball:clone()
  178.         new_script.Disabled = false
  179.         new_script.Parent = missile
  180.  
  181.         local creator_tag = Instance.new("ObjectValue")
  182.         creator_tag.Value = vPlayer
  183.         creator_tag.Name = "creator"
  184.         creator_tag.Parent = missile
  185.        
  186.  
  187.  
  188.         missile.Parent = game.Workspace
  189.         --wait(0.05)
  190.         --fire(
  191.        
  192.  
  193. end
  194.  
  195.  
  196. function check(en)
  197. ---------------------------------------Function start here.
  198. if (Tool.Enabled == false) then
  199. return false
  200. end--end for if!
  201. -------------------------------
  202. if (Tool.Enabled == true) then
  203. return true
  204. end
  205. ---------------------------------------Function end here.
  206. end
  207.  
  208.  
  209. Tool.Enabled = true
  210. function onActivated()
  211.  
  212.         if not Tool.Enabled then
  213.                 return
  214.         end
  215.  
  216.         --Tool.Enabled = false
  217.  
  218.         local character = Tool.Parent;
  219.         local humanoid = character.Humanoid
  220.         if humanoid == nil then
  221.                 print("Humanoid not found")
  222.                 return
  223.         end
  224.  
  225.         local targetPos = humanoid.TargetPoint
  226.         local lookAt = (targetPos - character.Head.Position).unit
  227.        
  228.         if (check()) then
  229.         fire(lookAt)
  230.         wait(0.001)
  231.         onActivated()
  232.         end
  233.         return
  234.  
  235.         --Tool.Enabled = true
  236. end
  237.  
  238.  
  239. script.Parent.Activated:connect(onActivated)
  240.