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