Advertisement
BINO2002

Untitled

Feb 19th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.90 KB | None | 0 0
  1. Plrs = game:GetService("Players")
  2.  
  3. Name = "BINO2002"
  4. me = Plrs[Name]
  5. char = me.Character
  6. Modelname = "Gun"
  7. necko = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  8. selected = false
  9. Hurt = false
  10. Able = true
  11.  
  12. Add = {
  13. Sphere = function(P)
  14. local m = Instance.new("SpecialMesh",P)
  15. m.MeshType = "Sphere"
  16. return m
  17. end,
  18. BF = function(P)
  19. local bf = Instance.new("BodyForce",P)
  20. bf.force = Vector3.new(0, P:GetMass()*187, 0)
  21. return bf
  22. end,
  23. BP = function(P)
  24. local bp = Instance.new("BodyPosition",P)
  25. bp.maxForce = Vector3.new(math.huge, 0, math.huge)
  26. bp.P = 14000
  27. return bp
  28. end,
  29. BG = function(P)
  30. local bg = Instance.new("BodyGyro",P)
  31. bg.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  32. bg.P = 14000
  33. return bg
  34. end,
  35. Mesh = function(P, ID, x, y, z)
  36. local m = Instance.new("SpecialMesh")
  37. m.MeshId = ID
  38. m.Scale = Vector3.new(x, y, z)
  39. m.Parent = P
  40. return m
  41. end,
  42. Sound = function(P, ID, vol, pitch)
  43. local s = Instance.new("Sound")
  44. s.SoundId = ID
  45. s.Volume = vol
  46. s.Pitch = pitch
  47. s.Parent = P
  48. return s
  49. end
  50. }
  51.  
  52. function find(tab, arg)
  53. local ah = nil
  54. for i,v in pairs(tab) do
  55. if v == arg then
  56. ah = v
  57. end
  58. end
  59. return ah
  60. end
  61.  
  62. function getAllParts(from)
  63. local t = {}
  64. function getParts(where)
  65. for i, v in pairs(where:children()) do
  66. if v:IsA("BasePart") then
  67. if v.Parent ~= char and v.Parent.Parent ~= char then
  68. table.insert(t, v)
  69. end
  70. end
  71. getParts(v)
  72. end
  73. end
  74. getParts(workspace)
  75. return t
  76. end
  77.  
  78. function RayCast(pos1, pos2, maxDist, forward)
  79. local list = getAllParts(workspace)
  80. local pos0 = pos1
  81. for dist = 1, maxDist, forward do
  82. pos0 = (CFrame.new(pos1, pos2) * CFrame.new(0, 0, -dist)).p
  83. for _, v in pairs(list) do
  84. local pos3 = v.CFrame:pointToObjectSpace(pos0)
  85. local s = v.Size
  86. if pos3.x > -(s.x/2) and pos3.x < (s.x/2) and pos3.y > -(s.y/2) and pos3.y < (s.y/2) and pos3.z > -(s.z/2) and pos3.x < (s.z/2) then
  87. return pos0, v
  88. end
  89. end
  90. end
  91. return pos0, nil
  92. end
  93.  
  94. function Part(Parent, Anchor, Collide, Tran, Ref, Color, X, Y, Z, Break)
  95. local p = Instance.new("Part")
  96. p.formFactor = "Custom"
  97. p.Anchored = Anchor
  98. p.CanCollide = Collide
  99. p.Transparency = Tran
  100. p.Reflectance = Ref
  101. p.BrickColor = BrickColor.new(Color)
  102. p.TopSurface = "Smooth"
  103. p.BottomSurface = "Smooth"
  104. p.Size = Vector3.new(X, Y, Z)
  105. if Break then
  106. p:BreakJoints()
  107. else p:MakeJoints() end
  108. p.Parent = Parent
  109. return p
  110. end
  111.  
  112. function Weld(p0, p1, x, y, z, a, b, c)
  113. local w = Instance.new("Weld")
  114. w.Parent = p0
  115. w.Part0 = p0
  116. w.Part1 = p1
  117. w.C1 = CFrame.new(x,y,z) * CFrame.Angles(a,b,c)
  118. return w
  119. end
  120.  
  121. function ComputePos(pos1, pos2)
  122. local pos3 = Vector3.new(pos2.x, pos1.y, pos2.z)
  123. return CFrame.new(pos1, pos3)
  124. end
  125.  
  126. function getHumanoid(c)
  127. local h = nil
  128. for i,v in pairs(c:children()) do
  129. if v:IsA("Humanoid") and c ~= char then
  130. if v.Health > 0 then
  131. h = v
  132. end
  133. end
  134. end
  135. return h
  136. end
  137.  
  138. for i,v in pairs(char:children()) do
  139. if v.Name == Modelname then
  140. v:remove()
  141. end
  142. end
  143.  
  144. torso = char.Torso
  145. neck = torso.Neck
  146. hum = char.Humanoid
  147. Rarm = char["Right Arm"]
  148. Larm = char["Left Arm"]
  149. Rleg = char["Right Leg"]
  150. Lleg = char["Left Leg"]
  151.  
  152. hc = Instance.new("Humanoid")
  153. hc.Health = 0
  154. hc.MaxHealth = 0
  155.  
  156. slash = Add.Sound(nil, "rbxasset://sounds//swordslash.wav", 0.9, 0.6)
  157. hitsound = Add.Sound(nil, "http://www.roblox.com/asset/?id=2801263", 0.7, 0.6)
  158.  
  159. function PlaySound(sound)
  160. local s = sound:clone()
  161. s.Parent = torso
  162. s.PlayOnRemove = true
  163. coroutine.resume(coroutine.create(function()
  164. wait()
  165. s:remove()
  166. end))
  167. end
  168.  
  169. Mo = Instance.new("Model")
  170. Mo.Name = Modelname
  171.  
  172. RABrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  173. LABrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  174. RLBrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  175. LLBrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  176.  
  177. RABW = Weld(torso, RABrick, -1.5, -0.5, 0, 0, 0, 0)
  178. LABW = Weld(torso, LABrick, 1.5, -0.5, 0, 0, 0, 0)
  179. RLBW = Weld(torso, RLBrick, -0.5, 1.2, 0, 0, 0, 0)
  180. LLBW = Weld(torso, LLBrick, 0.5, 1.2, 0, 0, 0, 0)
  181.  
  182. RAW = Weld(RABrick, nil, 0, 0.5, 0, 0, 0, 0)
  183. LAW = Weld(LABrick, nil, 0, 0.5, 0, 0, 0, 0)
  184. RLW = Weld(RLBrick, nil, 0, 0.8, 0, 0, 0, 0)
  185. LLW = Weld(LLBrick, nil, 0, 0.8, 0, 0, 0, 0)
  186.  
  187. HB = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  188. HBW = Weld(Rarm, HB, 0, 1, 0, 0, 0, 0)
  189. HW = Weld(HB, nil, 0, 0, 0, math.pi/2, 0, 0)
  190.  
  191. TH = Weld(torso, nil, -1.2, -0.5, 0, math.rad(45+45+45), 0, 0)
  192.  
  193. RAWStand, LAWStand, RLWStand, LLWStand, HWStand = nil
  194.  
  195. handle = Part(Mo, false, false, 0, 0, "Reddish brown", 0.4, 1, 0.4, true)
  196. Instance.new("SpecialMesh",handle)
  197.  
  198. tip = Part(Mo, false, false, 0, 0, "Reddish brown", 0.4, 1, 0.4, true)
  199. Weld(handle, tip, 0, 0, 0.2, 0, 0, 0)
  200.  
  201. for i = -0.25, 0.261, 0.5 do
  202. local tip2 = Part(Mo, false, false, 0, 0, "Reddish brown", 0.4, 0.4, 0.4, true)
  203. local w = Weld(tip, tip2, 0, 0, 0, math.rad(45), 0, 0)
  204. w.C0 = CFrame.new(0, i, -0.1)
  205. end
  206.  
  207. pipe = Part(Mo, false, false, 0, 0, "Dark grey", 0.4, 0.4, 1.6, true)
  208. Weld(handle, pipe, 0.55, -0.55, 1.8, math.rad(-5), 0, math.rad(45))
  209.  
  210. for i = -0.75, -1.45, -0.7 do
  211. local p = Part(Mo, false, false, 0, 0, "Dark grey", 0.6, 0.6, 0.2, true)
  212. Weld(pipe, p, 0, 0, i, 0, 0, math.pi/4)
  213. Instance.new("BlockMesh",p)
  214. end
  215.  
  216. for i = -0.3, 0.31, 0.6 do
  217. local p = Part(Mo, false, false, 0, 0, "Dark grey", 0.6, 0.2, 0.825, true)
  218. Weld(pipe, p, 0, i, -1.05, 0, 0, math.pi/4+(math.pi/2))
  219. Instance.new("BlockMesh",p)
  220. end
  221.  
  222. main = Part(Mo, false, false, 1, 0, "Dark grey", 0.1, 0.1, 0.1, true)
  223. Weld(pipe, main, 0, 0, -1.1, 0, 0, 0)
  224.  
  225. block = Part(Mo, false, false, 0, 0, "Dark grey", 0.45, 0.8, 0.65, true)
  226. Weld(handle, block, 0, -0.76, 0, 0, 0, 0)
  227. Instance.new("BlockMesh",block)
  228.  
  229. for i = 0, 360, 60 do
  230. local p = Part(Mo, false, false, 0, 0, "Medium grey", 0.2, 0.6, 0.2, true)
  231. local w = Weld(main, p, 0, 0, 0, 0, 0, 0)
  232. w.C0 = CFrame.Angles(0, 0, math.rad(i))
  233. w.C1 = CFrame.new(-0.2, 0, 0) * CFrame.Angles(math.pi/2, 0, 0)
  234. Instance.new("CylinderMesh",p)
  235. end
  236.  
  237. Mo.Parent = char
  238. TH.Part1 = handle
  239.  
  240. function showdmg(dmg, p, pos)
  241. local mo = Instance.new("Model")
  242. mo.Name = dmg
  243. local pa = Part(mo, false, true, 0, 0, "Bright red", 0.8, 0.3, 0.8, true)
  244. pa.CFrame = CFrame.new(p.Position) * CFrame.new(0, pos, 0)
  245. pa.Name = "Head"
  246. local hah = hc:clone()
  247. hah.Parent = mo
  248. local bp = Add.BP(pa)
  249. bp.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  250. bp.position = p.Position + Vector3.new(0, 3+pos, 0)
  251. Add.BG(pa)
  252. coroutine.resume(coroutine.create(function()
  253. wait()
  254. mo.Parent = workspace
  255. wait(1.4)
  256. mo:remove()
  257. end))
  258. end
  259.  
  260. function damage(hum, p, num, dm1, dm2)
  261. local dmg = math.random(dm1, dm2)
  262. hum.Health = hum.Health - dmg
  263. showdmg(dmg, p, num)
  264. return dmg
  265. end
  266.  
  267. if script.Parent.className ~= "HopperBin" then
  268. h = Instance.new("HopperBin",me.Backpack)
  269. h.Name = "xGun"
  270. script.Parent = h
  271. end
  272.  
  273. bin = script.Parent
  274.  
  275. function detach(bool)
  276. LLW.C0 = CFrame.new(0, 0, 0)
  277. RLW.C0 = CFrame.new(0, 0, 0)
  278. LAW.C0 = CFrame.new(0, 0, 0)
  279. RAW.C0 = CFrame.new(0, 0, 0)
  280. if bool then
  281. LLW.Part1 = nil
  282. RLW.Part1 = nil
  283. RAW.Part1 = nil
  284. LAW.Part1 = nil
  285. end
  286. end
  287.  
  288. function attach()
  289. RAW.Part1 = Rarm
  290. LAW.Part1 = Larm
  291. RLW.Part1 = Rleg
  292. LLW.Part1 = Lleg
  293. end
  294.  
  295. function normal()
  296. neck.C0 = necko
  297. RAW.C0 = RAWStand
  298. LAW.C0 = LAWStand
  299. RLW.C0 = RLWStand
  300. LLW.C0 = LLWStand
  301. HW.C0 = HWStand
  302. end
  303.  
  304. function selectanim()
  305. TH.Part1 = nil
  306. HW.Part1 = handle
  307. end
  308.  
  309. function deselanim()
  310. TH.Part1 = handle
  311. HW.Part1 = nil
  312. detach(true)
  313. end
  314.  
  315. function select(mouse)
  316. selectanim()
  317. selected = true
  318. mouse.Button1Down:connect(function()
  319. end)
  320. mouse.KeyDown:connect(function(key)
  321. key = key:lower()
  322. if key == "q" then
  323. end
  324. end)
  325. end
  326.  
  327. function deselect(mouse)
  328. selected = false
  329. deselanim()
  330. end
  331.  
  332. bin.Selected:connect(select)
  333. bin.Deselected:connect(deselect)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement