Advertisement
naser2345

bat mobile

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