Advertisement
DANIOS

batmobile

Mar 23rd, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 38.19 KB | None | 0 0
  1. ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  2.  
  3.  
  4. print("Loaded")
  5. local modelName="BatMobile"
  6. local player
  7. local torso
  8. --#Local Functions
  9. local c=function(f) coroutine.resume(coroutine.create(f)) end
  10. --#Settings
  11. local inf=math.huge
  12. local pi=math.pi
  13. local mr=math.rad
  14. local ms=math.sin
  15. local mc=math.cos
  16. local mrand=math.random
  17. local cn=CFrame.new
  18. local ca=CFrame.Angles
  19. local ti=table.insert
  20. local tr=table.remove
  21. local model2=Instance.new("Model", workspace) model2.Name=modelName
  22. local gui=Instance.new("ScreenGui") gui.Name=modelName
  23. local skincolor="Really black"
  24. local body={}
  25. local animate={}
  26. local obj={}
  27. local dmg=mrand(10000, 10000)
  28. local mouse
  29. local walkSpeed=100
  30. local combo=0
  31. local switch=0
  32. local key=false
  33. local hit=false
  34. local block=false
  35. local trails
  36. local speed=0
  37. local add={
  38. Part=function(par, a, c, col, t, s, cf, ms)
  39. local p=Instance.new("Part", par) pcall(function() p.TopSurface="Smooth" p.BottomSurface="Smooth" p.formFactor="Custom" p.Anchored=a p.CanCollide=c p.BrickColor=BrickColor.new(col) p.Transparency=t p.Size=s p.CFrame=cf or cn() end)
  40. local m=Instance.new("BlockMesh", p) pcall(function() m.Scale=ms or Vector3.new(1, 1, 1) end)
  41. return p
  42. end;
  43. Cylinder=function(par, a, c, col, t, s, cf, ms)
  44. local p=Instance.new("Part", par) pcall(function() p.TopSurface="Smooth" p.BottomSurface="Smooth" p.formFactor="Custom" p.Anchored=a p.CanCollide=c p.BrickColor=BrickColor.new(col) p.Transparency=t p.Size=s p.CFrame=cf or cn() end)
  45. local m=Instance.new("CylinderMesh", p) pcall(function() m.Scale=ms or Vector3.new(1, 1, 1) end)
  46. return p
  47. end;
  48. Wedge=function(par, a, c, col, t, s, cf, ms)
  49. local p=Instance.new("WedgePart", par) pcall(function() p.TopSurface="Smooth" p.BottomSurface="Smooth" p.formFactor="Custom" p.Anchored=a p.CanCollide=c p.BrickColor=BrickColor.new(col) p.Transparency=t p.Size=s p.CFrame=cf or cn() end)
  50. local m=Instance.new("SpecialMesh", p) pcall(function() m.Scale=ms or Vector3.new(1, 1, 1) m.MeshType="Wedge" end)
  51. return p
  52. end;
  53. Gui=function(ins, par, bc, bg, tc, fs, text, t, s, pos)
  54. local g=Instance.new(ins, par) pcall(function() g.BorderColor=BrickColor.new(bc) g.BackgroundColor=BrickColor.new(bg) g.TextColor=BrickColor.new(tc) g.FontSize=fs g.Font="ArialBold" g.Text=text g.BackgroundTransparency=t g.Size=s g.Position=pos end)
  55. return g
  56. end;
  57. Weld=function(par, p1, cf)
  58. local w=Instance.new("Weld", par) pcall(function() w.Part0=w.Parent or par w.Part1=p1 w.C1=cf or cn() end)
  59. return w
  60. end;
  61. Mesh=function(ins, par, s, t, id, tid, of)
  62. pcall(function() for i, v in pairs(par:children()) do if v:isA("BlockMesh") or v:isA("CylinderMesh") or v:isA("SpecialMesh") then v:remove() end end end)
  63. local m=Instance.new(ins, par) pcall(function() m.Scale=s or Vector3.new(1, 1, 1) m.Offset=of or Vector3.new() m.MeshId=id or "" m.TextureId=tid or "" m.MeshType=t end)
  64. return m
  65. end;
  66. Sound=function(parent, id, pitch, volume)
  67. local s=Instance.new("Sound", parent) pcall(function() s.SoundId=id s.Volume=volume or 1 s.Pitch=pitch or 1 end)
  68. return s
  69. end;
  70. }
  71. local Sounds={
  72. Slash="rbxasset://sounds//swordslash.wav";
  73. Hit="http://www.roblox.com/asset/?id=11113679 ";
  74. Equip="rbxasset://sounds/unsheath.wav";
  75. Charge="http://www.roblox.com/asset/?id=2101137";
  76. ElectricShortage="http://roblox.com/asset/?id=10209481";
  77. ElectricSound="http://www.roblox.com/asset/?id=10756118";
  78. Electric="http://www.roblox.com/asset/?id=2800815";
  79. Abscond="http://www.roblox.com/asset/?id=2767090";
  80. Cannon="http://www.roblox.com/asset/?id=2920959";
  81. Bash="http://www.roblox.com/asset/?id=25270310";
  82. Suirize="http://roblox.com/asset/?id=10209605";
  83. Heli="http://www.roblox.com/asset/?id=27112125";
  84. }
  85. local Decals={
  86. }
  87. local Meshes={
  88. Charge="http://www.roblox.com/asset/?id=20329976";
  89. Noob="http://www.roblox.com/asset/?id=29515710";
  90. Ring="http://www.roblox.com/asset/?id=3270017";
  91. Crown="http://www.roblox.com/asset/?id=1323306";
  92. Spring="http://www.roblox.com/Asset/?id=9753878";
  93. Sword="rbxasset://fonts/sword.mesh";
  94. Shield="http://www.roblox.com/asset/?id=50798797";
  95. Diamond="http://www.roblox.com/Asset/?id=9756362";
  96. Shuriken="http://www.roblox.com/asset/?id=11112101";
  97. ShurikenT="http://www.roblox.com/asset/?id=11112112"
  98. }
  99. function createParts()
  100. --#GuiDescendants
  101. obj.AL=add.Gui("TextLabel", gui, "Really black", "Really black", "White", "Size18", "Speed(speed)", 0, UDim2.new(0, 150, 0, 50), UDim2.new(0, 0, 0, 150))
  102. obj.AL2=add.Gui("TextLabel", obj.AL, "Really black", "Really black", "White", "Size18", "HeavyBreak(V)", 0, UDim2.new(1, 0, 1, 0), UDim2.new(0, 0, 1, 0))
  103. obj.AL3=add.Gui("TextLabel", obj.AL2, "Really black", "Really black", "White", "Size18", "Rocket(R)", 0, UDim2.new(1, 0, 1, 0), UDim2.new(0, 0, 1, 0))
  104. obj.AL4=add.Gui("TextLabel", obj.AL3, "Really black", "Really black", "White", "Size18", "MachineGun(F)", 0, UDim2.new(1, 0, 1, 0), UDim2.new(0, 0, 1, 0))
  105. obj.AL5=add.Gui("TextLabel", obj.AL4, "Really black", "Really black", "White", "Size18", "Boost(B)", 0, UDim2.new(1, 0, 1, 0), UDim2.new(0, 0, 1, 0))
  106. obj.AL6=add.Gui("TextLabel", obj.AL5, "Really black", "Really black", "White", "Size18", "Blade(C)", 0, UDim2.new(1, 0, 1, 0), UDim2.new(0, 0, 1, 0))
  107. obj.AL7=add.Gui("TextLabel", obj.AL6, "Really black", "Really black", "White", "Size18", "Hover(X)", 0, UDim2.new(1, 0, 1, 0), UDim2.new(0, 0, 1, 0))
  108. obj.AL8=add.Gui("TextLabel", obj.AL7, "Really black", "Really black", "White", "Size18", "SelfDestruct(G)", 0, UDim2.new(1, 0, 1, 0), UDim2.new(0, 0, 1, 0))
  109. -- obj.AL9=add.Gui("TextLabel", obj.AL8, "Really black", "Really black", "White", "Size18", "MaximumArmor(Z)", 0, UDim2.new(1, 0, 1, 0), UDim2.new(0, 0, 1, 0))
  110. --#CarDesgin
  111. for i, v in pairs(model2:children()) do
  112. if i~=1 then return end
  113. end
  114. obj.Frame=add.Part(model2, false, true, "Really black", 0, Vector3.new(5, 1, 10))
  115. obj.sup=add.Part(model2, false, true, "Really black", 0, Vector3.new(1, 1, 5))
  116. obj.supW=add.Weld(obj.sup, obj.Frame, cn(-3, 0, -5))
  117. obj.Wheels=add.Cylinder(model2, false, true, "White", 0, Vector3.new(3, 1.5, 3))
  118. obj.WheelsW=add.Weld(obj.Wheels, obj.sup, cn(1.25, 0, -3)*ca(0, 0, mr(90)))
  119. obj.w=add.Wedge(model2, false, true, "Really black", 0, Vector3.new(1, 1, 1))
  120. obj.wW=add.Weld(obj.w, obj.sup, cn(0, 0, -3)*ca(0, 0, mr(90)))
  121. obj.w=add.Wedge(model2, false, true, "Really black", 0, Vector3.new(1, 1, 5))
  122. obj.wW=add.Weld(obj.w, obj.sup, cn(0, 1, 0))
  123. obj.w=add.Wedge(model2, false, true, "Really black", 0, Vector3.new(1, 1, 5))
  124. obj.wW=add.Weld(obj.w, obj.sup, cn(0, -1, 0)*ca(0, 0, pi))
  125. obj.w=add.Wedge(model2, false, true, "Really black", 0, Vector3.new(.5, 1, 2))
  126. obj.wW=add.Weld(obj.w, obj.Frame, cn(-2, 0, -6)*ca(0, 0, -mr(90)))
  127. obj.sup=add.Part(model2, false, true, "Really black", 0, Vector3.new(1, 1, 5))
  128. obj.supW=add.Weld(obj.sup, obj.Frame, cn(3, 0, -5))
  129. obj.Wheels2=add.Cylinder(model2, false, true, "White", 0, Vector3.new(3, 1.5, 3))
  130. obj.Wheels2W=add.Weld(obj.Wheels2, obj.sup, cn(-1.25, 0, -3)*ca(0, 0, mr(90)))
  131. obj.w=add.Wedge(model2, false, true, "Really black", 0, Vector3.new(1, 1, 1))
  132. obj.wW=add.Weld(obj.w, obj.sup, cn(0, 0, -3)*ca(0, 0, mr(-90)))
  133. obj.w=add.Wedge(model2, false, true, "Really black",0, Vector3.new(1, 1, 5))
  134. obj.wW=add.Weld(obj.w, obj.sup, cn(0, 1, 0))
  135. obj.w=add.Wedge(model2, false, true, "Really black", 0, Vector3.new(1, 1, 5))
  136. obj.wW=add.Weld(obj.w, obj.sup, cn(0, -1, 0)*ca(0, 0, pi))
  137. obj.w=add.Wedge(model2, false, true, "Really black", 0, Vector3.new(.5, 1, 2))
  138. obj.wW=add.Weld(obj.w, obj.Frame, cn(2, 0, -6)*ca(0, 0, mr(90)))
  139. obj.Wheel3=add.Cylinder(model2, false, true, "White", 0, Vector3.new(4.5, 2, 4.5))
  140. obj.Wheel3W=add.Weld(obj.Wheel3, obj.Frame, cn(3.5, .5, 5)*ca(0, 0, mr(90)))
  141. obj.Wheel4=add.Cylinder(model2, false, true, "White", 0, Vector3.new(4.5, 2, 4.5))
  142. obj.Wheel4W=add.Weld(obj.Wheel4, obj.Frame, cn(-3.5, .5, 5)*ca(0, 0, mr(-90)))
  143. obj.sR=add.Cylinder(model2, false, true, "Really black", 0, Vector3.new(3.5, 6, 3.5))
  144. obj.sRW=add.Weld(obj.sR, obj.Frame, cn(2.6, 0, 0)*ca(mr(90), 0, 0))
  145. obj.sL=add.Cylinder(model2, false, true, "Really black", 0, Vector3.new(3.5, 6, 3.5))
  146. obj.sLW=add.Weld(obj.sL, obj.Frame, cn(-2.6, 0, 0)*ca(mr(90), 0, 0))
  147. obj.VC=Instance.new("VehicleSeat", model2) obj.VC.HeadsUpDisplay=false obj.VC.CanCollide=false
  148. obj.VC.Size=Vector3.new(2, 1, 2)
  149. obj.VC.BottomSurface="Weld"
  150. obj.VCW=add.Weld(obj.VC, obj.Frame, cn(0, .2, 0))
  151. obj.w=add.Wedge(model2, false, true, "Really black", 0, Vector3.new(1, 1, 5))
  152. obj.wW=add.Weld(obj.w, obj.Frame, cn(0, 0, -5.5)*ca(0, pi/2, -pi/2))
  153. obj.w=add.Wedge(model2, false, true, "Really black",0, Vector3.new(1, 1, 5))
  154. obj.wW=add.Weld(obj.w, obj.Frame, cn(0, 0, -5.5)*ca(0, -pi/2, pi/2))
  155. obj.w=add.Wedge(model2, false, true, "Really black", 0, Vector3.new(1.5, 1, 3))
  156. obj.wW=add.Weld(obj.w, obj.Frame, cn(0, 0, -7)*ca(0, 0, 0))
  157. obj.p=add.Part(model2, false, true, "Really black", 0, Vector3.new(4, .5, 1))
  158. obj.pW=add.Weld(obj.p, obj.Frame, cn(0, .5, -5))
  159. obj.w=add.Wedge(model2, false, true, "Really black", 0, Vector3.new(.5, 3, 4))
  160. obj.wW=add.Weld(obj.w, obj.Frame, cn(.5, .6, -4.5)*ca(0, pi/2, -pi/2))
  161. obj.w=add.Wedge(model2, false, false, "Really black", .5, Vector3.new(1, 2, 1.5))
  162. obj.wW=add.Weld(obj.w, obj.Frame, cn(2, 1.25, -3.25)*ca(0, 0, -pi/2))
  163. obj.w=add.Wedge(model2, false, true, "Really black", 0, Vector3.new(.5, 3, 4))
  164. obj.wW=add.Weld(obj.w, obj.Frame, cn(-.5, .6, -4.5)*ca(0, -pi/2, pi/2))
  165. obj.w=add.Wedge(model2, false, false, "Really black", .5, Vector3.new(1, 2, 1.5))
  166. obj.wW=add.Weld(obj.w, obj.Frame, cn(-2, 1.25, -3.25)*ca(0, 0, pi/2))
  167. obj.w=add.Wedge(model2, false, true, "Really black", 0, Vector3.new(2, 1, 1.5))
  168. obj.wW=add.Weld(obj.w, obj.Frame, cn(0, 1.25, -4.75)*ca(0, 0, 0))
  169. obj.ps=add.Part(model2, false, false, "Really black", 0, Vector3.new(4, 1, 5))
  170. obj.psW=add.Weld(obj.ps, obj.Frame, cn(0, 2, 0))
  171. obj.w=add.Wedge(model2, false, false, "Really black", 0, Vector3.new(2, 1, 1.5))
  172. obj.wW=add.Weld(obj.w, obj.ps, cn(0, 0, -3.25)*ca(0, 0, 0))
  173. obj.w=add.Wedge(model2, false, false, "Really black", 0, Vector3.new(5, 1, 2))
  174. obj.wW=add.Weld(obj.w, obj.ps, cn(3, 0, 0)*ca(0, -pi/2, 0))
  175. obj.w=add.Wedge(model2, false, true, "Really black", 0, Vector3.new(5, 2, 1))
  176. obj.wW=add.Weld(obj.w, obj.ps, cn(3.5, -1.5, 0)*ca(pi, -pi/2, 0))
  177. obj.w=add.Wedge(model2, false, false, "Really black", 0, Vector3.new(5, 1, 2))
  178. obj.wW=add.Weld(obj.w, obj.ps, cn(-3, 0, 0)*ca(0, pi/2, 0))
  179. obj.w=add.Wedge(model2, false, true, "Really black", 0, Vector3.new(5, 2, 1))
  180. obj.wW=add.Weld(obj.w, obj.ps, cn(3.5, -1.5, 0)*ca(pi, -pi/2, 0))
  181. obj.csupt=add.Cylinder(model2, false, true, "Really black", 0, Vector3.new(1, 2.5, 1))
  182. obj.csuptW=add.Weld(obj.csupt, obj.Frame, cn(-3, 2, 2.5)*ca(mr(15), 0, 0))
  183. obj.csupt=add.Cylinder(model2, false, true, "Really black", 0, Vector3.new(1, 2.5, 1))
  184. obj.csuptW=add.Weld(obj.csupt, obj.Frame, cn(-2, 2, 2.5)*ca(mr(15), 0, 0))
  185. obj.p=add.Part(model2, false, false, "Really black", 0, Vector3.new(3.5, .2, 3))
  186. obj.pW=add.Weld(obj.p, obj.Frame, cn(-2.5, 3, 4))
  187. obj.csupt=add.Cylinder(model2, false, true, "Really black", 0, Vector3.new(1, 2.5, 1))
  188. obj.csuptW=add.Weld(obj.csupt, obj.Frame, cn(3, 2, 2.5)*ca(mr(15), 0, 0))
  189. obj.csupt=add.Cylinder(model2, false, true, "Really black", 0, Vector3.new(1, 2.5, 1))
  190. obj.csuptW=add.Weld(obj.csupt, obj.Frame, cn(2, 2, 2.5)*ca(mr(15), 0, 0))
  191. obj.p=add.Part(model2, false, false, "Really black", 0, Vector3.new(3.5, .2, 3))
  192. obj.pW=add.Weld(obj.p, obj.Frame, cn(2.5, 3, 4))
  193. obj.w=add.Wedge(model2, false, false, "Really black", 0, Vector3.new(5, 2, 2.5))
  194. obj.wW=add.Weld(obj.w, obj.ps, cn(0, -.5, 3.75)*ca(0, pi, 0))
  195. obj.c=add.Cylinder(model2, false, false, "Really black", 0, Vector3.new(3.5, 2, 3.5))
  196. obj.cW=add.Weld(obj.c, obj.Frame, cn(0, 1, 5)*ca(mr(90), 0, 0))
  197. obj.TS=add.Cylinder(model2, false, true, "Really black", 0, Vector3.new(3, 2, 3))
  198. obj.TSW=add.Weld(obj.TS, obj.c, cn(0, 1, 0)*ca(0, 0, 0))
  199. obj.TSM=add.Mesh("SpecialMesh", obj.TS, Vector3.new(.75, .1, .75), nil, "http://www.roblox.com/Asset/?id=10207677")
  200. obj.top=add.Part(model2, false, false, "Really black", 0, Vector3.new(4, 1.5, 4))
  201. obj.topW=add.Weld(obj.top, obj.ps, cn(0, .5, 0))
  202. obj.topM=add.Mesh("SpecialMesh", obj.top, Vector3.new(1, 1, 1), "Sphere")
  203. --Machine Gun
  204. obj.mr=add.Part(model2, false, false, "Really black", 0, Vector3.new(1, 1, 2))
  205. obj.mrw=add.Weld(obj.mr, obj.Frame, cn(0, 0, 0))
  206. obj.br=add.Part(model2, false, false, "Really black", 0, Vector3.new(1.5, 1.5, 2.5))
  207. obj.brw=add.Weld(obj.br, obj.mr, cn(1, 0, 0))
  208. obj.gr=add.Part(model2, false, false, "Really black", 0, Vector3.new(.5, .5, 1))
  209. obj.grw=add.Weld(obj.gr, obj.br, cn(0, 0, -1))
  210. obj.ml=add.Part(model2, false, false, "Really black", 0, Vector3.new(1, 1, 2))
  211. obj.mlw=add.Weld(obj.ml, obj.Frame, cn(0, 0, 0))
  212. obj.bl=add.Part(model2, false, false, "Really black", 0, Vector3.new(1.5, 1.5, 2.5))
  213. obj.blw=add.Weld(obj.bl, obj.ml, cn(-1, 0, 0))
  214. obj.gl=add.Part(model2, false, false, "Really black", 0, Vector3.new(.5, .5, 1))
  215. obj.glw=add.Weld(obj.gl, obj.bl, cn(0, 0, -1))
  216. --Rocket
  217. obj.rck=add.Cylinder(model2, false, false, "Really black", 0, Vector3.new(1, 4, 1))
  218. obj.rckw=add.Weld(obj.rck, obj.Frame, cn(0, 0, 0)*ca(-pi/2, 0, 0))
  219. obj.rock=add.Part(model2, false, false, "Really black", 1, Vector3.new(1, 1, 1))
  220. obj.rockw=add.Weld(obj.rock, obj.rck, cn(0, 1.5, 0)*ca(pi/2, 0, 0))
  221. --Blade
  222. obj.p1=add.Part(model2, false, false, "White", 0, Vector3.new(3, .2, 1))
  223. obj.p1w=add.Weld(obj.p1, obj.Frame, cn(0, 0, 0))
  224. obj.br=add.Wedge(model2,false, false, "White", 0, Vector3.new(.2, 2, 1))
  225. obj.brW=add.Weld(obj.br, obj.p1, cn(2.5, 0, 0)*ca(0, 0, -pi/2))
  226.  
  227. obj.p2=add.Part(model2, false, false, "White", 0, Vector3.new(3, .2, 1))
  228. obj.p2w=add.Weld(obj.p2, obj.Frame, cn(0, 0, 0))
  229. obj.bl=add.Wedge(model2,false, false, "White", 0, Vector3.new(.2, 2, 1))
  230. obj.blW=add.Weld(obj.bl, obj.p2, cn(-2.5, 0, 0)*ca(0, 0, pi/2))
  231. --Animate
  232. animate={
  233. ["Wheel"]=function(cf)
  234. obj.Wheels2W.C1=cn(-1.25, 0, -3)*ca(0, 0, mr(90))*cf
  235. end,
  236. ["Wheel2"]=function(cf)
  237. obj.WheelsW.C1=cn(1.25, 0, -3)*ca(0, 0, mr(90))*cf
  238. end,
  239. ["Wheel3"]=function(cf)
  240. obj.Wheel3W.C1=cn(3.5, .5, 5)*ca(0, 0, mr(90))*cf
  241. end,
  242. ["Wheel4"]=function(cf)
  243. obj.Wheel4W.C1=cn(-3.5, .5, 5)*ca(0, 0, mr(-90))*cf
  244. end,
  245. ["MachineGunR"]=function(cf)
  246. obj.mrw.C1=cf
  247. end,
  248. ["MachineGunL"]=function(cf)
  249. obj.mlw.C1=cf
  250. end,
  251. ["MachineGunL"]=function(cf)
  252. obj.mlw.C1=cf
  253. end,
  254. ["Rocket"]=function(cf)
  255. obj.rckw.C1=cf*ca(-pi/2, 0, 0)
  256. end,
  257. ["BladeR"]=function(cf)
  258. obj.p1w.C1=cf
  259. end,
  260. ["BladeL"]=function(cf)
  261. obj.p2w.C1=cf
  262. end,
  263. ["Booster"]=function(cf)
  264. obj.cW.C1=cn(0, 1, 5)*ca(mr(90), 0, 0)*cf
  265. end,
  266. }
  267. end
  268. function play(soundid, pitch, volume)
  269. local sound=add.Sound(workspace, soundid, pitch, volume)
  270. sound:play()
  271. c(function() wait(5) sound:remove() end)
  272. end
  273. function fade(part, incr)
  274. if part:isA("BasePart") then
  275. for i=part.Transparency, 1, incr do part.Transparency=i wait() end
  276. elseif part:isA("Model") then
  277. for i, v in pairs(part:children() or part) do
  278. if v:isA("BasePart") then
  279. c(function()for i=v.Transparency, 1, incr do v.Transparency=i wait() end end)
  280. end
  281. end
  282. end
  283. end
  284. function appear(part, incr)
  285. if part:isA("BasePart") then
  286. for i=part.Transparency, 0, -incr do v.Transparency=i wait() end
  287. elseif part:isA("Model") then
  288. for i, v in pairs(part:children() or part) do
  289. if v:isA("BasePart") then
  290. c(function()for i=v.Transparency, 0, -incr do v.Transparency=i wait() end end)
  291. end
  292. end
  293. end
  294. end
  295. function computePos(pos, pos2)
  296. local pos3=Vector3.new(pos2.x, pos.y, pos2.z)
  297. return cn(pos, pos3)
  298. end
  299. function rayCast(pos, dir, max, ingore)
  300. return workspace:findPartOnRay(Ray.new(pos, dir.unit*(max or 999)), ignore)
  301. end
  302. function nearObj(pos, dis)
  303. local temp
  304. local distance=dis
  305. for i, v in pairs(workspace:children()) do
  306. if v:isA("Model") then
  307. temp=v:findFirstChild("Torso")
  308. local humanoid=v:findFirstChild("Humanoid")
  309. if temp and humanoid and v~=char and (temp.CFrame.p-pos).magnitude<distance then
  310. distance=(temp.CFrame.p-pos).magnitude
  311. return temp.Parent
  312. end
  313. end
  314. end
  315. end
  316. function trail(prt, cf, thick, col)
  317. c(function()
  318. trails=true
  319. local old=(prt.CFrame*(cf or cn())).p
  320. local trm=Instance.new("Model", workspace)
  321. while trails do
  322. local new=(prt.CFrame*(cf or cn())).p
  323. local mag=(old-new).magnitude
  324. local dis=(old+new)/2
  325. local trail=add.Cylinder(trm, true, false, col or "White", .2, Vector3.new(1, 1, 1), cn(dis, new)*ca(pi/2, 0, 0), Vector3.new(thick, mag, thick))
  326. old=new
  327. c(function()
  328. for i=1, 0, -.1 do trail.Mesh.Scale=trail.Mesh.Scale*Vector3.new(i, 1, i) wait() end
  329. trail:remove()
  330. end)
  331. wait()
  332. end
  333. trm:remove()
  334. end)
  335. end
  336. boosts=false
  337. function boost(prt, thick, col)
  338. c(function()
  339. boosts=true
  340. local trm=Instance.new("Model", workspace)
  341. while boosts do
  342. local ef=add.Part(trm, false, false, "Bright yellow", .2, Vector3.new(1, .5, 1))
  343. local efm=add.Mesh("SpecialMesh", ef, Vector3.new(thick, thick, thick), nil, Meshes.Crown)
  344. add.Weld(ef, prt, cn(0, 4, 0)*ca(0, mr(mrand(-360, 360)), 0))
  345. game.Debris:addItem(ef, .2)
  346. local trail=add.Part(trm, true, false, col or "White", .2, Vector3.new(1, 1, 1), prt.CFrame*cn(0, 2, 0)*ca(mr(mrand(-360, 360)), mr(mrand(-360, 360)), mr(mrand(-360, 360))), Vector3.new(thick, thick, thick))
  347. c(function()
  348. for i=1, 0, -.1 do trail.Mesh.Scale=trail.Mesh.Scale*Vector3.new(i, i, i) wait() end
  349. trail:remove()
  350. end)
  351. wait()
  352. end
  353. trm:remove()
  354. end)
  355. end
  356. function stickHit(from, to)
  357. local stickW=add.Weld(from, to, to.CFrame:inverse()*from.CFrame)
  358. stickW.C0=from.CFrame:inverse()*from.CFrame
  359. return stickW
  360. end
  361. function glowMesh(prt, size, speed)
  362. local glow=prt:clone() add.Weld(prt, glow)
  363. glow.Parent=workspace
  364. glow.Anchored=false
  365. glow.CanCollide=false
  366. for i, v in pairs(glow:children()) do
  367. if v:isA("SpecialMesh") or v:isA("BlockMesh") or v:isA("CylinderMesh") then
  368. c(function()
  369. for i=0, size, speed do v.Scale=v.Scale+Vector3.new(i, i, i) wait() end
  370. end)
  371. c(function()
  372. fade(glow, .1) glow:remove()
  373. end)
  374. end
  375. end
  376. end
  377. function sliceHit(prt)
  378. prt.Touched:connect(function(h)
  379. if key==true and not hit and h.Parent~=player.Character then
  380. hit=true
  381. pcall(function()
  382. print("Slicing")
  383. local pYPos=h.Position.y-(h.Size.y/2)
  384. local sYPos=prt.Position.y
  385. if sYPos<=pYPos or sYPos>=(pYPos+h.Size.y) then return end
  386. local p=h:clone() p.Parent=workspace p.Anchored=false p.CanCollide=true
  387. local p2=h:clone() p2.Parent=workspace p2.Anchored=false p2.CanCollide=true
  388. h:remove()
  389. p.formFactor="Custom"
  390. p2.formFactor="Custom"
  391. p.TopSurface="Smooth"
  392. p.BottomSurface="Smooth"
  393. p.Friction=0
  394. p2.Friction=0
  395. p.Size=Vector3.new(h.Size.x, sYPos-pYPos, h.Size.z)
  396. p2.Size=Vector3.new(h.Size.x, p2.Size.y-(sYPos-pYPos), h.Size.z)
  397. p.CFrame=h.CFrame*CFrame.new(0, -p2.Size.y/2, 0)
  398. p2.CFrame=h.CFrame*CFrame.new(0, p.Size.y/2, 0)
  399. c(function()
  400. wait(5)
  401. p:remove() p2:remove()
  402. end)
  403. end)
  404. wait(.1)
  405. hit=false
  406. end
  407. end)
  408. end
  409. function dmgHit(prt)
  410. prt.Touched:connect(function(h)
  411. if key==true and h.Parent:findFirstChild("Humanoid") and not hit and h.Parent~=player.Character then
  412. hit=true
  413. local fakeM=Instance.new("Model", workspace)
  414. fakeM.Name=-dmg*mrand(1, 1.5)
  415. local hHuman=h.Parent:findFirstChild("Humanoid")
  416. local hTorso=h.Parent:findFirstChild("Torso")
  417. local fakeH=Instance.new("Humanoid", fakeM) fakeH.MaxHealth=0 fakeH.Health=0
  418. local label=add.Part(fakeM, false, false, "Bright red", 0, Vector3.new(.2, .2, .2), h.CFrame*cn(mrand(-2, 2), 4, mrand(-2, 2)), Vector3.new(.1, .1, .1)) label.Name="Head"
  419. c(function()
  420. local bv=Instance.new("BodyVelocity", label)
  421. bv.maxForce=Vector3.new(inf, inf, inf)
  422. bv.velocity=Vector3.new(0, 4.5, 0)
  423. Game.Debris:addItem(fakeM, 1)
  424. end)
  425. hHuman.Health=hHuman.Health-dmg
  426. wait(.1)
  427. hit=false
  428. end
  429. end)
  430. end
  431. function rockHit(prt)
  432. prt.Touched:connect(function(h)
  433. if key==true and not hit and h.Parent~=player.Character then
  434. hit=true
  435. if h.Parent:findFirstChild("Humanoid") then
  436. local fakeM=Instance.new("Model", workspace)
  437. fakeM.Name=-dmg*mrand(2, 5.5)
  438. local hHuman=h.Parent:findFirstChild("Humanoid")
  439. local hTorso=h.Parent:findFirstChild("Torso")
  440. local fakeH=Instance.new("Humanoid", fakeM) fakeH.MaxHealth=0 fakeH.Health=0
  441. local label=add.Part(fakeM, false, false, "Bright red", 0, Vector3.new(.2, .2, .2), h.CFrame*cn(mrand(-2, 2), 4, mrand(-2, 2)), Vector3.new(.1, .1, .1)) label.Name="Head"
  442. c(function()
  443. local bv=Instance.new("BodyVelocity", label)
  444. bv.maxForce=Vector3.new(inf, inf, inf)
  445. bv.velocity=Vector3.new(0, 4.5, 0)
  446. Game.Debris:addItem(fakeM, 1)
  447. end)
  448. hHuman.Health=hHuman.Health-dmg
  449. end
  450. local e=Instance.new("Explosion", workspace)
  451. e.BlastPressure=2
  452. e.BlastRadius=4
  453. e.Position=h.Position
  454. prt:remove()
  455. wait()
  456. hit=false
  457. end
  458. end)
  459. end
  460. function makeCrater(cf, size)
  461. local to=cf.p-(cf.p+Vector3.new(0, 200, 0))
  462. local hit, pos=rayCast(cf.p, to)
  463. if hit and pos then
  464. for i=1, 3 do
  465. local cr=add.Part(workspace, true, false, hit.Color or "Brown", 0, Vector3.new(1+size, size, 2+size), cn(pos+Vector3.new(mrand(-2+size/2, 2+size/2), 0, mrand(-2+size/2, 2+size/2)))*ca(mr(mrand(-4, 4)), mr(mrand(-360, 360)), mr(mrand(-35, 35))))
  466. end
  467. end
  468. end
  469. function makeLightning(from, to, thick, col)
  470. local magnitude=(from.p-to.p).magnitude
  471. local distance=(from.p+to.p)/2
  472. local pattern=add.Part(workspace, true, false, "White", 1, Vector3.new(.2, .2, magnitude), cn(distance, from.p))
  473. local fromPosProx=from.p
  474. local lim=Instance.new("Model", workspace)
  475. for i=1, 4 do
  476. local fromPosProx2=fromPosProx
  477. local random=Vector3.new(mrand(-1, 1), mrand(-1, 1), mrand(-1, 1))
  478. local findSize=pattern.Size.z/4
  479. local findOffSet=pattern.CFrame.lookVector*-1
  480. local compute=i*findSize*findOffSet
  481. local newfromPos=from.p
  482. local newEndPos=cn(random+compute+newfromPos).p
  483. local magnitude=(fromPosProx2-newEndPos).magnitude
  484. local distance=(fromPosProx2+newEndPos)/2
  485. local lightning=add.Part(lim, true, false, col or "Bright yellow", 0, Vector3.new(1, 1, 1), cn(distance, fromPosProx2), Vector3.new(thick, thick, magnitude))
  486. fromPosProx=newEndPos
  487. game.Debris:addItem(lim, 1)
  488. end
  489. pattern:remove()
  490. end
  491. function makeCircle(prt ,dis, rep, angle)
  492. local cm=Instance.new("Model", prt.Parent)
  493. for i=angle*2/rep, angle*2 do
  494. local prt2=prt:clone()
  495. prt2.Parent=cm
  496. prt2.CFrame=prt.CFrame*cn(dis*ms(i), 0, dis*mc(i))
  497. end
  498. prt:remove()
  499. return cm
  500. end
  501. local bv=Instance.new("BodyVelocity") bv.maxForce=Vector3.new(inf, 0, inf)
  502. local bav=Instance.new("BodyAngularVelocity") bav.maxTorque=Vector3.new(inf, inf, inf)
  503. function startBoost()
  504. boost(obj.TS, 3, "Bright orange")
  505. while boosts do
  506. if speed<150 then
  507. speed=speed+2
  508. bv.velocity=obj.Frame.CFrame.lookVector*speed
  509. end
  510. wait()
  511. end
  512. end
  513. local fire=false
  514. function startMG()
  515. fire=true
  516. for i=0, 1, .1 do
  517. animate.MachineGunR(cn(4.5*i, 0, 0))
  518. animate.MachineGunL(cn(-4.5*i, 0, 0))
  519. wait()
  520. end
  521. while fire do
  522. local mb=add.Part(workspace, false, false, "Bright yellow", 0, Vector3.new(.2, .2, 1), obj.gr.CFrame+obj.gr.CFrame.lookVector)
  523. dmgHit(mb)
  524. local f=Instance.new("BodyForce", mb) f.force=Vector3.new(0, mb:getMass()*196.25, 0)
  525. local v=Instance.new("BodyVelocity", mb) v.maxForce=Vector3.new(inf, inf, inf) v.velocity=mb.CFrame.lookVector*200
  526. local ef=add.Part(workspace, false, false, "Bright yellow", .2, Vector3.new(1, .5, 1))
  527. local efm=add.Mesh("SpecialMesh", ef, Vector3.new(1, 1, 1), nil, Meshes.Crown)
  528. add.Weld(ef, obj.gr, cn(0, 0, -1)*ca(-pi/2, 0, 0))
  529. game.Debris:addItem(ef, .1)
  530. game.Debris:addItem(mb, 1.5)
  531.  
  532. local mb2=add.Part(workspace, false, false, "Bright yellow", 0, Vector3.new(.2, .2, 1), obj.gl.CFrame+obj.gl.CFrame.lookVector)
  533. dmgHit(mb2)
  534. local f=Instance.new("BodyForce", mb2) f.force=Vector3.new(0, mb2:getMass()*196.25, 0)
  535. local v=Instance.new("BodyVelocity", mb2) v.maxForce=Vector3.new(inf, inf, inf) v.velocity=mb2.CFrame.lookVector*200
  536. local ef=add.Part(workspace, false, false, "Bright yellow", .2, Vector3.new(1, .5, 1))
  537. local efm=add.Mesh("SpecialMesh", ef, Vector3.new(1, 1, 1), nil, Meshes.Crown)
  538. add.Weld(ef, obj.gl, cn(0, 0, -1)*ca(-pi/2, 0, 0))
  539. game.Debris:addItem(ef, .1)
  540. game.Debris:addItem(mb2, 1.5)
  541. wait(.1)
  542. end
  543. for i=1, 0, -.1 do
  544. animate.MachineGunR(cn(4.5*i, 0, 0))
  545. animate.MachineGunL(cn(-4.5*i, 0, 0))
  546. wait()
  547. end
  548. end
  549. function startRocket()
  550. for i=0, 1, .1 do
  551. animate.Rocket(cn(0, 0, -8*i))
  552. wait()
  553. end
  554. wait(.2)
  555. local mb=add.Part(workspace, false, false, "Bright yellow", 0, Vector3.new(1, 1, 2), obj.rock.CFrame+obj.rock.CFrame.lookVector*2)
  556. rockHit(mb)
  557. local f=Instance.new("BodyForce", mb) f.force=Vector3.new(0, mb:getMass()*196.25, 0)
  558. local v=Instance.new("BodyVelocity", mb) v.maxForce=Vector3.new(inf, inf, inf) v.velocity=mb.CFrame.lookVector*300
  559. local ef=add.Part(workspace, false, false, "Bright yellow", .2, Vector3.new(1, .5, 1))
  560. local efm=add.Mesh("SpecialMesh", ef, Vector3.new(1.5, 1.5, 1.5), nil, Meshes.Crown)
  561. add.Weld(ef, obj.rock, cn(0, 0, -.5)*ca(-pi/2, 0, 0))
  562. game.Debris:addItem(ef, .1)
  563. game.Debris:addItem(mb, 1.5)
  564. wait(.2)
  565. for i=1, 0, -.1 do
  566. animate.Rocket(cn(0, 0, -8*i))
  567. wait()
  568. end
  569. end
  570. function startSelfDestruct()
  571. obj.VCW:remove()
  572. obj.VC.CanCollide=false
  573. local p=Instance.new("BodyPosition", obj.VC) p.maxForce=Vector3.new(inf, inf, inf) p.position=obj.VC.Position+Vector3.new(0, 300, 0)
  574. wait(1)
  575. local e=Instance.new("Explosion", workspace)
  576. e.BlastPressure=500
  577. e.BlastRadius=500
  578. e.Position=obj.Frame.Position
  579. end
  580. local slice=false
  581. function startSlice()
  582. slice=true
  583. for i=0, 1, .1 do
  584. animate.BladeR(cn(5.5*i, 0, 0))
  585. animate.BladeL(cn(-5.5*i, 0, 0))
  586. wait()
  587. end
  588. sliceHit(obj.p1) sliceHit(obj.p2)
  589. sliceHit(obj.br) sliceHit(obj.bl)
  590. while slice do wait() end
  591. for i=1, 0, -.1 do
  592. animate.BladeR(cn(5.5*i, 0, 0))
  593. animate.BladeL(cn(-5.5*i, 0, 0))
  594. wait()
  595. end
  596. end
  597. local hover=false
  598. function startHover()
  599. bv.maxForce=Vector3.new(inf, inf, inf)
  600. for i=0, 1, .05 do
  601. animate.Wheel(ca(0, 0, mr(90*i)))
  602. animate.Wheel2(ca(0, 0, mr(-90*i)))
  603. animate.Wheel3(ca(0, 0, mr(90*i)))
  604. animate.Wheel4(ca(0, 0, mr(-90*i)))
  605. animate.Booster(ca(mr(90*i), 0, 0))
  606. bv.velocity=bv.velocity+Vector3.new(0, 10*i, 0)
  607. wait()
  608. end
  609. boost(obj.TS, 3, "Bright orange")
  610. bv.velocity=Vector3.new(0, 0, 0)
  611. while hover do bv.velocity=bv.velocity+Vector3.new(0, 10, 0) wait(1) bv.velocity=Vector3.new(0, 0, 0) wait(.5) bv.velocity=bv.velocity-Vector3.new(0, 10, 0) wait(1) bv.velocity=Vector3.new(0, 0, 0) wait(.5) end
  612. for i=1, 0, -.05 do
  613. animate.Wheel(ca(0, 0, mr(90*i)))
  614. animate.Wheel2(ca(0, 0, mr(-90*i)))
  615. animate.Wheel3(ca(0, 0, mr(90*i)))
  616. animate.Wheel4(ca(0, 0, mr(-90*i)))
  617. animate.Booster(ca(mr(90*i), 0, 0))
  618. bv.velocity=bv.velocity-Vector3.new(0, 5-5*i, 0)
  619. wait()
  620. end
  621. bv.maxForce=Vector3.new(inf, 0, inf)
  622. boosts=false
  623. end
  624. function KeyDown(k)
  625. if k=="b" and not key and not boosts then
  626. key=true
  627. startBoost()
  628. end
  629. if k=="x" and not hover then
  630. hover=true
  631. startHover()
  632. elseif k=="x" and hover then
  633. hover=false
  634. end
  635. if k=="c" and not key and not slice then
  636. key=true
  637. startSlice()
  638. end
  639. if k=="r" and not key then
  640. key=true
  641. startRocket()
  642. key=false
  643. end
  644. if k=="g" and not key then
  645. key=true
  646. startSelfDestruct()
  647. key=false
  648. end
  649. if k=="f" and not key and not fire then
  650. key=true
  651. startMG()
  652. end
  653. if k=="v" and not key then
  654. key=true
  655. speed=0
  656. key=false
  657. end
  658. end
  659. function KeyUp(k)
  660. if k=="b" and boosts and key then
  661. key=false
  662. boosts=false
  663. end
  664. if k=="f" and fire and key then
  665. key=false
  666. fire=false
  667. end
  668. if k=="c" and slice and key then
  669. key=false
  670. slice=false
  671. end
  672. end
  673. local engine=false
  674. createParts()
  675. obj.VC.ChildAdded:connect(function(ad)
  676. if ad.Name=="SeatWeld" then
  677. torso=ad.Part1
  678. local vc=obj.VC
  679. if torso then print("Found")
  680. player=game.Players:getPlayerFromCharacter(torso.Parent)
  681. mouse=player:GetMouse()
  682. ad.C1=ad.C1*CFrame.new(0, 0, 1.5)
  683. bv.Parent=obj.Frame
  684. bav.Parent=obj.Frame
  685. gui.Parent=player.PlayerGui
  686. mouse.KeyDown:connect(KeyDown)
  687. mouse.KeyUp:connect(KeyUp)
  688. engine=true
  689. while torso and vc and engine do print("working")
  690. obj.AL.Text="Speed("..speed..")"
  691. if vc.Throttle==1 and speed<100 then
  692. speed=speed+1
  693. bv.velocity=obj.Frame.CFrame.lookVector*speed
  694. end
  695. if vc.Throttle==-1 and speed>-100 then
  696. speed=speed-1
  697. bv.velocity=obj.Frame.CFrame.lookVector*speed
  698. end
  699. if vc.Throttle==0 and speed>0 then
  700. speed=speed-1
  701. bv.velocity=obj.Frame.CFrame.lookVector*speed
  702. end
  703. if vc.Throttle==0 and speed<0 then
  704. speed=speed+1
  705. bv.velocity=obj.Frame.CFrame.lookVector*speed
  706. end
  707. if vc.Steer==1 then
  708. bav.angularvelocity=Vector3.new(0, -2, 0)
  709. if not hover then
  710. animate.Wheel2(ca(mr(-25), 0, 0))
  711. animate.Wheel(ca(mr(-25), 0, 0))
  712. end
  713. end
  714. if vc.Steer==-1 then
  715. bav.angularvelocity=Vector3.new(0, 2, 0)
  716. if not hover then
  717. animate.Wheel2(ca(mr(25), 0, 0))
  718. animate.Wheel(ca(mr(25), 0, 0))
  719. end
  720. end
  721. if vc.Steer==0 then
  722. bav.angularvelocity=Vector3.new(0, 0, 0)
  723. if not hover then
  724. animate.Wheel2(ca(0, 0, 0))
  725. animate.Wheel(ca(0, 0, 0))
  726. end
  727. end
  728. wait()
  729. end
  730. end
  731. end
  732. end)
  733. obj.VC.ChildRemoved:connect(function()
  734. bv.Parent=nil bav.Parent=nil gui.Parent=nil engine=false
  735. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement