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