Xander_

Untitled

Jun 30th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.97 KB | None | 0 0
  1.  
  2. pcall(function() game.Players.LocalPlayer.Backpack.Pistol:Destroy() end)
  3. bin = Instance.new("HopperBin", game.Players.LocalPlayer.Backpack)
  4. bin.Name = "Pistol"
  5.  
  6. maincolor = "Really black"
  7. bulletcolor = "Bright yellow"
  8. bullettrans = 0.65
  9. firerate = 0.175
  10. mindmg = 13
  11. maxdmg = 19
  12.  
  13. player = game.Players.LocalPlayer
  14. char = player.Character
  15. Anims = char:FindFirstChild("Animate")
  16. if Anims then
  17. Anims:Destroy()
  18. end
  19. torsoz = char:findFirstChild("Torso")
  20. local LA = char:findFirstChild("Left Arm")
  21. local LS = torsoz:findFirstChild("Left Shoulder")
  22. local H = char:findFirstChild("Head")
  23. local N = torsoz:findFirstChild("Neck")
  24. local RA = char:findFirstChild("Right Arm")
  25. local RS = torsoz:findFirstChild("Right Shoulder")
  26. local S = Instance.new("Sound")
  27. S.SoundId = "http://www.roblox.com/asset/?id=2760979"
  28. S.Volume = 1
  29.  
  30. local Joint = Instance.new("Motor")
  31. local Joint2 = Instance.new("Motor")
  32. local Joint3 = Instance.new("Motor")
  33. local Gun = Instance.new("Part")
  34. local Gun2 = Instance.new("Part")
  35. local GT1 = Instance.new("Part")
  36. local GT2 = Instance.new("Part")
  37. local GunSide = 1
  38.  
  39. function Shoot(mouse, side, length)
  40. if length == nil then
  41. length = 20
  42. end
  43. local shotside = GT1
  44. if side == 2 then
  45. shotside = GT2
  46. end
  47. S.Parent = shotside
  48. S.Pitch = math.random(90, 110)/100
  49. S:Play()
  50. local pos1 = CFrame.new(shotside.Position, mouse.Hit.p)
  51. local pos2 = pos1.lookVector*length
  52. local ray = Ray.new(pos1.p, pos2)
  53. local hitz, enz = workspace:findPartOnRay(ray, char) --- char means the ray wont hit anything parented to your character
  54. print(hitz)
  55. local line = Instance.new("Part", torsoz)
  56. line.CanCollide = false
  57. line.Locked = true
  58. line.Anchored = true
  59. line.BrickColor = BrickColor.new(bulletcolor)
  60. line.TopSurface = 0
  61. line.BottomSurface = 0
  62. line.formFactor = "Custom"
  63. line.Size = Vector3.new(0.5,0.5,0.5)
  64. line.Transparency = bullettrans
  65. line.CFrame = CFrame.new((pos1.p + enz)/2,pos1.p) * CFrame.Angles(math.pi/2,0,0)
  66. local mesh = Instance.new("CylinderMesh", line)
  67. mesh.Scale = Vector3.new(0.3,(shotside.Position - enz).magnitude*2,0.3)
  68. game:GetService("Debris"):AddItem(line, 0.11)
  69.  
  70. local hum = nil
  71. local DD = false
  72. if hitz ~= nil then
  73. if hitz.Parent.className == "Model" then
  74. for i, v in pairs(hitz.Parent:children()) do
  75. if v.className == "Humanoid" then
  76. hum = v
  77. end
  78. end
  79. elseif hitz.Parent.Parent.className == "Model" and hitz.Parent.className == "Hat" then
  80. for i, v in pairs(hitz.Parent.Parent:children()) do
  81. if v.className == "Humanoid" then
  82. hum = v
  83. DD = true
  84. end
  85. end
  86. end
  87. if hum ~= nil then
  88. local dmg = math.random(mindmg, maxdmg)
  89. if DD == true then
  90. dmg = dmg * 1.5
  91. end
  92. hum:TakeDamage(dmg)
  93. print("Damage: "..dmg)
  94. end
  95. end
  96.  
  97. end
  98.  
  99. deb = true
  100. function B1D(mouse)
  101. if deb == true then
  102. deb = false
  103. Shoot(mouse, GunSide, 150)
  104. if GunSide == 1 then
  105. Joint.C0 = CFrame.new(-1.75,0.5,-0.5) * CFrame.Angles(math.pi/2,0,-math.pi/3) * CFrame.Angles(0,-0.375,0) * CFrame.Angles(0.2,0,0) * CFrame.new(0,0.2,-0.2)
  106. GunSide = 2
  107. else
  108. Joint2.C0 = CFrame.new(0.85,0.5,-0.75) * CFrame.Angles(math.pi/2,0,-math.pi/3) * CFrame.Angles(0,0.375,0) * CFrame.Angles(0.2,0,0) * CFrame.new(0,0.2,-0.2)
  109. GunSide = 1
  110. end
  111. wait(firerate)
  112. Joint.C0 = CFrame.new(-1.75,0.5,-0.5) * CFrame.Angles(math.pi/2,0,-math.pi/3) * CFrame.Angles(0,-0.375,0)
  113. Joint2.C0 = CFrame.new(0.85,0.5,-0.75) * CFrame.Angles(math.pi/2,0,-math.pi/3) * CFrame.Angles(0,0.375,0)
  114. deb = true
  115. end
  116. end
  117.  
  118. function Key(key, mouse)
  119. end
  120.  
  121. function Equip()
  122. LS.Part0 = nil
  123. RS.Part0 = nil
  124. N.Part0 = nil
  125. Joint = Instance.new("Motor", torsoz)
  126. Joint.Name = "TopLeft"
  127. Joint.Part0 = torsoz
  128. Joint.Part1 = LA
  129. Joint.C0 = CFrame.new(-1.75,0.5,-0.5) * CFrame.Angles(math.pi/2,0,-math.pi/3) * CFrame.Angles(0,-0.375,0)
  130. Joint2 = Instance.new("Motor", torsoz)
  131. Joint2.Name = "TopRight"
  132. Joint2.Part0 = torsoz
  133. Joint2.Part1 = RA
  134. Joint2.C0 = CFrame.new(0.85,0.5,-0.75) * CFrame.Angles(math.pi/2,0,-math.pi/3) * CFrame.Angles(0,0.375,0)
  135. Joint3 = Instance.new("Motor", torsoz)
  136. Joint3.Name = "Nek"
  137. Joint3.Part0 = torsoz
  138. Joint3.Part1 = H
  139. Joint3.C0 = CFrame.new(0,1.5,0) * CFrame.Angles(0,math.pi/3,0)
  140.  
  141. Gun = Instance.new("Part", torsoz)
  142. Gun.Name = "PistolGunFtwNob"
  143. Gun.formFactor = "Custom"
  144. Gun.Size = Vector3.new(0.5,0.5,0.5)
  145. Gun.Locked = true
  146. Gun.CanCollide = false
  147. Gun.Position = torsoz.Position
  148. Gun.BrickColor = BrickColor.new(maincolor)
  149. Gun.TopSurface = 0
  150. Gun.BottomSurface = 0
  151. Gun.Transparency = 0
  152. GT1 = Gun:Clone()
  153. GT1.Name = "GunTip"
  154. GT1.Parent = Gun
  155. GT1.Transparency = 1
  156. local w = Instance.new("Motor", GT1)
  157. w.Part0 = Gun
  158. w.Part1 = GT1
  159. w.C0 = CFrame.new(0,0.35,-0.5)
  160. local mesh = Instance.new("SpecialMesh", Gun)
  161. mesh.MeshId = "http://www.roblox.com/asset/?id=4372594"
  162. mesh.Scale = Vector3.new(1.2,1.2,1.2)
  163. Gun2 = Gun:Clone()
  164. Gun2.Parent = Gun
  165. GT2 = Gun2.GunTip
  166. local w = Instance.new("Motor", Gun)
  167. w.Part0 = LA
  168. w.Part1 = Gun
  169. w.C0 = CFrame.new(0,-1.4,-0.2) * CFrame.Angles(-math.pi/2,0,0)
  170. local w = Instance.new("Motor", Gun2)
  171. w.Part0 = RA
  172. w.Part1 = Gun2
  173. w.C0 = CFrame.new(0,-1.4,-0.2) * CFrame.Angles(-math.pi/2,0,0)
  174.  
  175.  
  176. end
  177.  
  178. function Unequip() --- trolo
  179. Gun:Destroy() -- for now
  180. end
  181.  
  182.  
  183. bin.Selected:connect(function(mouse)
  184. mouse.Button1Down:connect(function() B1D(mouse) end)
  185. mouse.KeyDown:connect(function(key) Key(key, mouse) end)
  186. wait()
  187. Equip()
  188. bg = Instance.new("BodyGyro", torsoz)
  189. bg.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
  190. bg.Name = "Gyro"
  191. bg.D = 100
  192. while Joint.Parent == torsoz do
  193. local pos1 = torsoz.Position
  194. local pos2 = Vector3.new(mouse.Hit.x, pos1.y,mouse.Hit.z)
  195. bg.cframe = CFrame.new(pos1, pos2) * CFrame.Angles(0,-math.pi/3,0)
  196. bg.Parent = torsoz
  197. wait()
  198. end
  199. end)
  200. bin.Deselected:connect(function()
  201. Joint:Destroy()
  202. Joint2:Destroy()
  203. Joint3:Destroy()
  204. bg:Destroy()
  205. LS.Part0 = torsoz
  206. LS.Part1 = LA
  207. RS.Part0 = torsoz
  208. RS.Part1 = RA
  209. N.Part0 = torsoz
  210. N.Part1 = H
  211. Unequip()
  212. end)
Add Comment
Please, Sign In to add comment