Facebook
From Billwa, 9 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 457
  1. ak47 = Instance.new("Tool")
  2. ak47.Parent = game.Players.Copenricus45.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.     damage = 2
  182.  
  183.         missile.Parent = game.Workspace
  184.         --wait(0.05)
  185.         --fire(
  186.        
  187.        
  188.         function onTouch(missile)
  189.         missile.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.