DANIOS

gyro gun

Apr 1st, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.31 KB | None | 0 0
  1. lp=game.Players.LocalPlayer
  2. pl=lp.Character
  3. tol=Instance.new("HopperBin",lp.Backpack)
  4. tol.Name="Gyro_Gun"
  5. for _,v in pairs(pl:GetChildren()) do if v.ClassName=="CharacterMesh" then v:remove() end end
  6. Part = function(x,y,z,color,tr,cc,an,parent)
  7. local p = Instance.new('Part',parent or Weapon)
  8. p.formFactor = 'Custom'
  9. p.Size = Vector3.new(x,y,z)
  10. p.BrickColor = BrickColor.new(color)
  11. p.CanCollide = cc
  12. p.Transparency = tr
  13. p.Anchored = an
  14. p.TopSurface,p.BottomSurface = 0,0
  15. return p end
  16. Weld = function(p0,p1,x,y,z,rx,ry,rz,par)
  17. p0.Position = p1.Position
  18. local w = Instance.new('Motor',par or p0)
  19. w.Part0 = p0
  20. w.Part1 = p1
  21. w.C1 = CFrame.new(x,y,z)*CFrame.Angles(rx,ry,rz)
  22. return w end
  23. Mesh = function(par,num,x,y,z)
  24. local msh = _
  25. if num == 1 then msh = Instance.new("CylinderMesh",par)
  26. elseif num == 2 then msh = Instance.new("SpecialMesh",par) msh.MeshType = 3
  27. elseif num == 3 then msh = Instance.new("BlockMesh",par)
  28. elseif type(num) == 'string' then msh = Instance.new("SpecialMesh",par) msh.MeshId = num
  29. end
  30. msh.Scale = Vector3.new(x,y,z)
  31. return msh end
  32. wPart = function(x,y,z,color,tr,cc,an,parent)
  33. local wp = Instance.new('WedgePart',parent or Weapon)
  34. wp.formFactor = 'Custom'
  35. wp.Size = Vector3.new(x,y,z)
  36. wp.BrickColor = BrickColor.new(color)
  37. wp.CanCollide = cc
  38. wp.Transparency = tr
  39. wp.Anchored = an
  40. wp.TopSurface,wp.BottomSurface = 0,0
  41. return wp end
  42.  
  43. function c1(mouse)
  44. f=true
  45. ft=false
  46. lo=true
  47. lop=false
  48. speed=50
  49. thro=1
  50. dmg= Part(1,1,1,'',1,false,false,wep)
  51. dmgwl= Weld(dmg,wep24,0,0,0,0,0,0,wep)
  52. function touch(hit)
  53. if hit.Parent:findFirstChild("Humanoid") ~= nil then
  54. hit.Parent:BreakJoints()
  55. end end
  56. dmg.Touched:connect(touch)
  57.  
  58. coroutine.wrap(function()
  59. for i=1,10 do wait()
  60. ma.Scale=ma.Scale+Vector3.new(.2,.2,.2)
  61. ma1.Scale=ma1.Scale+Vector3.new(.3,.3,.3)
  62. end
  63. end)()
  64.  
  65. coroutine.wrap(function()
  66. while wait()do
  67. for i=1,speed do wait()
  68. if ft==true then break end
  69. spin1w= Weld(spin1,pl['Right Arm'],0,-3,-.75,0,i/thro,0,wep)
  70. spin2w= Weld(spin2,pl['Right Arm'],0,-3,-.75,i/thro,0,0,wep)
  71. end
  72. if ft==true then break end
  73. end end)()
  74. m=lp:GetMouse()
  75. coroutine.wrap(function()
  76. while wait(1) do
  77. if lop==true then break end
  78. bpos.position=m.Hit.p
  79. wait(.5)
  80. coroutine.wrap(function()
  81. for i=1,10 do wait()
  82. bpos.position=wep23.Position
  83. end
  84. end)()
  85. end
  86. end)()
  87. end
  88.  
  89. function c2(mouse)
  90. ft=true
  91. f=false
  92. lo=false
  93. lop=true
  94. speed=360
  95. thro=10
  96. dmg:remove()
  97.  
  98. coroutine.wrap(function()
  99. while wait()do
  100. if lo==true then break end
  101. bpos.position=wep23.Position
  102. end end)()
  103.  
  104. coroutine.wrap(function()
  105. for i=1,10 do wait()
  106. ma.Scale=ma.Scale-Vector3.new(.2,.2,.2)
  107. ma1.Scale=ma1.Scale-Vector3.new(.3,.3,.3)
  108. end
  109. end)()
  110.  
  111. coroutine.wrap(function()
  112. while wait()do
  113. for i=1,speed do wait()
  114. if f==true then break end
  115. spin1w= Weld(spin1,pl['Right Arm'],0,-3,-.75,0,i/thro,0,wep)
  116. spin2w= Weld(spin2,pl['Right Arm'],0,-3,-.75,i/thro,0,0,wep)
  117. end
  118. if f==true then break end
  119. end end)()
  120. end
  121.  
  122. tol.Selected:connect(function(mouse)
  123. mouse.Button1Down:connect(function() c1(mouse) end)
  124. mouse.Button1Up:connect(function() c2(mouse) end)
  125. f=false
  126. lo=false
  127. wep=Instance.new("Model",pl)
  128. bas = Part(1,1,1,'',1,false,false,wep)
  129. bas:BreakJoints()
  130. wep1= Part(.1,.3,1,'Really black',0,false,false,wep)
  131. wl1= Weld(wep1,pl['Right Arm'],0,-1,0,0,0,0,wep)
  132. wep2= Part(.5,2,.5,'Really black',0,false,false,wep)
  133. wl2= Weld(wep2,pl['Right Arm'],0,-1,-.75,0,0,0,wep)
  134. wep3= Part(.1,.2,1.5,'Really black',0,false,false,wep)
  135. wl3= Weld(wep3,pl['Right Arm'],0,-1.5,-.25,-math.pi/5,0,0,wep)
  136. wep4= Part(.3,1,.3,'Institutional white',0,false,false,wep)m=Mesh(wep4,1,1,1,1)
  137. wl4= Weld(wep4,pl['Right Arm'],0,-2,-.75,0,0,0,wep)
  138. wep5= Part(.2,.35,.2,'Really black',0,false,false,wep)m=Mesh(wep5,1,1,1,1)
  139. wl5= Weld(wep5,pl['Right Arm'],0,-2.25,-.75,math.pi/2,0,0,wep)
  140. wep6= Part(.2,.35,.2,'Really black',0,false,false,wep)m=Mesh(wep6,1,1,1,1)
  141. wl6= Weld(wep6,pl['Right Arm'],0,-2.25,-.75,math.pi/2,0,math.pi/2,wep)
  142. wep7= Part(.2,.2,.2,'Really black',0,false,false,wep)
  143. m=Mesh(wep7,'http://www.roblox.com/asset/?id=3270017',2.25,2.25,.1)
  144. wl7= Weld(wep7,pl['Right Arm'],0,-3,-.75,0,math.pi/3,0,wep)
  145. --spinners--
  146. spin1= Part(.2,.2,.2,'Institutional white',0,false,false,wep)
  147. m=Mesh(spin1,'http://www.roblox.com/asset/?id=3270017',1.75,1.75,.1)
  148. spin2= Part(.2,.2,.2,'Really black',0,false,false,wep)
  149. m=Mesh(spin2,'http://www.roblox.com/asset/?id=3270017',1.25,1.25,.1)
  150. --derrize
  151. wep8= Part(1,1,1,'Really black',0,false,false,wep)
  152. m=Mesh(wep8,1,.1,2,.1)
  153. wl8= Weld(wep8,pl['Right Arm'],0,-3,-.75,0,math.pi/3,0,wep)
  154. wep8= Part(1,1,1,'Really black',0,false,false,wep)
  155. m=Mesh(wep8,1,.3,1,.3)
  156. wl8= Weld(wep8,pl['Right Arm'],0,-3,-.75,0,math.pi/3,0,wep)
  157. wep8.Material='Granite'
  158. wep9= Part(1,1,1,'Lime green',0,false,false,wep)
  159. m=Mesh(wep9,1,.4,.3,.4)
  160. wl9= Weld(wep9,pl['Right Arm'],0,-3,-.75,0,math.pi/3,0,wep)
  161. wep9.Material='Granite'
  162. wep9= Part(1,1,1,'Really black',0,false,false,wep)
  163. m=Mesh(wep9,1,.41,.27,.41)
  164. wl9= Weld(wep9,pl['Right Arm'],0,-3,-.75,0,math.pi/3,0,wep)
  165. wep9.Material='Granite'
  166. wep10= Part(1,1,1,'Really black',0,false,false,wep)
  167. m=Mesh(wep10,1,.2,.5,.2)
  168. wl10= Weld(wep10,pl['Right Arm'],0,-4,-.75,0,math.pi/3,0,wep)
  169. wep11= Part(1,1,1,'Institutional white',0,false,false,wep)
  170. m=Mesh(wep11,1,.2,.5,.2)
  171. wl11= Weld(wep11,pl['Right Arm'],0,-4.5,-.75,0,math.pi/3,0,wep)
  172. wep12= Part(.2,.35,.2,'Really black',0,false,false,wep)m=Mesh(wep12,1,1,1,1)
  173. wl12= Weld(wep12,pl['Right Arm'],0,-4.25,-.75,math.pi/2,0,0,wep)
  174. wep13= Part(.2,.35,.2,'Really black',0,false,false,wep)m=Mesh(wep13,1,1,1,1)
  175. wl13= Weld(wep13,pl['Right Arm'],0,-4.25,-.75,math.pi/2,0,math.pi/2,wep)
  176. wep14= Part(.2,.35,.2,'Really black',0,false,false,wep)m=Mesh(wep14,1,1,1,1)
  177. wl14= Weld(wep14,pl['Right Arm'],0,-4.5,-.75,math.pi/2,0,0,wep)
  178. wep15= Part(.2,.35,.2,'Really black',0,false,false,wep)m=Mesh(wep15,1,1,1,1)
  179. wl15= Weld(wep15,pl['Right Arm'],0,-4.5,-.75,math.pi/2,0,math.pi/2,wep)
  180. wep16= Part(1,1,1,'Really black',0,false,false,wep) m=Mesh(wep16,3,2,.1,.1)
  181. wl16= Weld(wep16,pl['Right Arm'],0,-4.7,-.75,math.pi/2,0,0,wep)
  182. wep17= Part(1,1,1,'Really black',0,false,false,wep) m=Mesh(wep17,3,.1,2,.1)
  183. wl17= Weld(wep17,pl['Right Arm'],0,-4.7,-.75,math.pi/2,0,0,wep)
  184. wep18= Part(1,1,1,'Really black',0,false,false,wep) m=Mesh(wep18,3,.1,1,.1)
  185. wl18= Weld(wep18,pl['Right Arm'],0,-5.1,-2,math.pi/5,0,0,wep)
  186. wep19= Part(1,1,1,'Really black',0,false,false,wep) m=Mesh(wep19,3,.1,1,.1)
  187. wl19= Weld(wep19,pl['Right Arm'],0,-5.1,.5,-math.pi/5,0,0,wep)
  188. wep20= Part(1,1,1,'Really black',0,false,false,wep) m=Mesh(wep20,3,1,.1,.1)
  189. wl20= Weld(wep20,pl['Right Arm'],1.35,-5,-.75,0,0,-math.pi/5,wep)
  190. wep21= Part(1,1,1,'Really black',0,false,false,wep) m=Mesh(wep21,3,1,.1,.1)
  191. wl21= Weld(wep21,pl['Right Arm'],-1.35,-5,-.75,0,0,math.pi/5,wep)
  192. wep22= Part(1,1,1,'Really black',0,false,false,wep) m=Mesh(wep22,'http://www.roblox.com/asset/?id=95387759',5,5,5)
  193. wl22= Weld(wep22,pl['Right Arm'],0,-4.7,-.75,-math.pi/2,0,0,wep)
  194.  
  195. wep23= Part(.1,.1,.1,'Really black',1,false,false,wep)
  196. wl23= Weld(wep23,pl['Right Arm'],0,-6,-.75,-math.pi/2,0,0,wep)
  197.  
  198. wep24= Part(.1,.1,.1,'Camo',0,false,false,wep)
  199. ma=Mesh(wep24,'http://www.roblox.com/asset/?id=1185246',0,0,0)
  200.  
  201. wep25= Part(.1,.1,.1,'Lime green',.5,false,false,wep)
  202. ma1=Mesh(wep25,'http://www.roblox.com/asset/?id=1185246',0,0,0)
  203. wl25= Weld(wep25,wep24,0,0,0,-0,0,0,wep)
  204.  
  205. bpos=Instance.new("BodyPosition",wep24)
  206. bpos.maxForce=Vector3.new(1e1000,1e1000,1e1000)
  207. coroutine.wrap(function()
  208. while wait()do
  209. if lo==true then break end
  210. bpos.position=wep23.Position
  211. end end)()
  212.  
  213. la1= Part(.1,.1,.1,'Lime green',.6,false,true,wep)
  214. coroutine.wrap(function()
  215. while wait() do
  216. Pos1 = wep18.Position
  217. Pos2 = wep24.Position
  218. Dist = (Pos1-Pos2).magnitude
  219. la1.Size = Vector3.new(0.1,0.1,Dist)
  220. la1.CFrame = CFrame.new(Pos1,Pos2)*CFrame.new(0,0,-Dist/2)
  221. end end)()
  222. la2= Part(.1,.1,.1,'Lime green',.6,false,true,wep)
  223. coroutine.wrap(function()
  224. while wait() do
  225. Pos1 = wep19.Position
  226. Pos2 = wep24.Position
  227. Dist = (Pos1-Pos2).magnitude
  228. la2.Size = Vector3.new(0.1,0.1,Dist)
  229. la2.CFrame = CFrame.new(Pos1,Pos2)*CFrame.new(0,0,-Dist/2)
  230. end end)()
  231. la3= Part(.1,.1,.1,'Lime green',.6,false,true,wep)
  232. coroutine.wrap(function()
  233. while wait() do
  234. Pos1 = wep20.Position
  235. Pos2 = wep24.Position
  236. Dist = (Pos1-Pos2).magnitude
  237. la3.Size = Vector3.new(0.1,0.1,Dist)
  238. la3.CFrame = CFrame.new(Pos1,Pos2)*CFrame.new(0,0,-Dist/2)
  239. end end)()
  240. la4= Part(.1,.1,.1,'Lime green',.6,false,true,wep)
  241. coroutine.wrap(function()
  242. while wait() do
  243. Pos1 = wep21.Position
  244. Pos2 = wep24.Position
  245. Dist = (Pos1-Pos2).magnitude
  246. la4.Size = Vector3.new(0.1,0.1,Dist)
  247. la4.CFrame = CFrame.new(Pos1,Pos2)*CFrame.new(0,0,-Dist/2)
  248. end end)()
  249.  
  250. speed=360
  251. thro=10
  252. coroutine.wrap(function()
  253. while wait()do
  254. for i=1,speed do wait()
  255. if f==true then break end
  256. spin1w= Weld(spin1,pl['Right Arm'],0,-3,-.75,0,i/thro,0,wep)
  257. spin2w= Weld(spin2,pl['Right Arm'],0,-3,-.75,i/thro,0,0,wep)
  258. end
  259. if ft==true then break end
  260. end
  261. end)()
  262.  
  263. fakel = Instance.new("Weld",wep)
  264. fakel.Part0 = pl.Torso
  265. fakel.Part1 = bas
  266. coroutine.wrap(function()
  267. for angle = 0, 45, 5 do
  268. if fakel == nil then return end
  269. fakel.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.Angles(math.rad(angle*2), math.rad(0--[[angle*.3]]), math.rad(0))
  270. wait()
  271. end
  272. end)()
  273. welditbro = Instance.new("Weld", wep)
  274. welditbro.C0 = CFrame.new(0, 0.5, 0)
  275. welditbro.Part0 = pl['Right Arm']
  276. welditbro.Part1 = bas
  277. end)
  278.  
  279. tol.Deselected:connect(function(_)
  280. f=true
  281. lo=true
  282. wep:remove()
  283. end)
Add Comment
Please, Sign In to add comment