Advertisement
Thefrozen106

Tank

Jun 13th, 2017
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.35 KB | None | 0 0
  1. --[[
  2. Controls:
  3. WASD for movement
  4. G to open hatch
  5. F fires cannon
  6. U points the cannon up
  7. J points the cannon down
  8. K rotates the cannon right
  9. H rotates the cannon left
  10. --]]
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20. local p = game:service'Players'.LocalPlayer
  21. local c = p.Character
  22. local bp = p.Backpack
  23. pcall(function() _G.mm:Remove() end)
  24. pcall(function() bp.RMTank:Remove() end)
  25. it = Instance.new
  26. v3=Vector3.new
  27. bc=BrickColor.new
  28. c3=Color3.new
  29. cn=CFrame.new
  30. ca=CFrame.Angles
  31. ti=table.insert
  32. tr=table.remove
  33. rn=math.random
  34. rd=math.rad
  35. mf=math.floor
  36. asset = "http://www.roblox.com/asset/?id="
  37. ds = {}
  38. ds.Claw = "10681506"
  39. ds.Ring = "3270017"
  40. ds.Crack = "49173398"
  41. ds.Cloud = "1095708"
  42. ds.Spike = "1033714"
  43. ds.Rock = "1290033"
  44. ds.Crown = "1323306"
  45. ds.Hood = "16952952"
  46. ds.Slash = "10209645"
  47. ds.Slash2 = "46760716"
  48. ds.MadFace = "2235131"
  49. ds.BanditMask = "20637493"
  50. ds.Hood2 = "25211365"
  51. ds.HoodT2 = "64240784"
  52. ds.Axe = "12768042"
  53. ds.AxeT = "12768034"
  54. ds.Fist = "65322375"
  55. ds.Tree1 = "1090398"
  56. ds.Vine = "13108500"
  57. ds.VineT = "17585271"
  58. ds.TreeTexture = "2861779"
  59. ds.Tug = "31173820" -- sound
  60. ds.Fire = "2693346" --"2760979"
  61. ds.Hit = "2801263"
  62. ds.BulletHole = "64291961"
  63. ds.Camo = "4268107"
  64. table.foreach(ds,function(a,b)
  65. if tonumber(b:sub(1,3)) then
  66. ds[a] = asset .. b game:service'ContentProvider':Preload(ds[a])
  67. end
  68. end)
  69. q = function(f)
  70. coroutine.resume(coroutine.create(function()
  71. f()
  72. end))
  73. end
  74. ft = function(tablez,item)
  75. for i=1,#tablez do
  76. if tablez[i] == item then
  77. return i
  78. end
  79. end
  80. return nil
  81. end
  82. pa = function(pa,pn,sh,x,y,z,c,a,tr,re,bc2)
  83. local fp=nil
  84. if sh ~= "Wedge" and sh ~= "CornerWedge" and sh ~= "VehicleSeat" and sh ~= "Seat" then
  85. fp=it("Part",pa)
  86. fp.Shape=sh
  87. fp.formFactor="Custom"
  88. elseif sh == "Wedge" then
  89. fp=it("WedgePart",pa)
  90. fp.formFactor="Custom"
  91. elseif sh == "CornerWedge" then
  92. fp=it("CornerWedgePart",pa)
  93. elseif sh == "VehicleSeat" then
  94. fp=it("VehicleSeat",pa)
  95. elseif sh == "Seat" then
  96. fp=it("Seat",pa)
  97. end
  98. fp.Size=v3(x,y,z)
  99. fp.Friction = 2
  100. fp.CanCollide=c
  101. fp.Anchored=false
  102. fp.BrickColor=bc(bc2)
  103. fp.Transparency=tr
  104. fp.Reflectance=re
  105. fp.BottomSurface=0
  106. fp.Name=pn
  107. fp.Locked = true
  108. --fp.FrontSurface="Hinge"
  109. fp.TopSurface=0
  110. fp.CFrame = cn(-9000,9000,-9000)
  111. fp:BreakJoints()
  112. fp.Anchored = a
  113. return fp
  114. end
  115. weld = function(pa,p0,p1,x,y,z,a,b,c)
  116. local fw=it("Weld",pa)
  117. fw.Part0=p0
  118. fw.Part1=p1
  119. fw.C0=cn(x,y,z) *ca(a,b,c)
  120. return fw
  121. end
  122. fade = function(prt,incr)
  123. q(function()
  124. for i=prt.Transparency,1,incr do
  125. prt.Transparency=i
  126. wait()
  127. end
  128. prt:Remove''
  129. end)
  130. end
  131. stick = function(hit2,hit)
  132. local weld=it("Weld")
  133. weld.Part0=hit2
  134. weld.Part1=hit
  135. local HitPos=hit2.Position
  136. local CJ=cn(HitPos)
  137. local C0=hit2.CFrame:inverse() *CJ
  138. local C1=hit.CFrame:inverse() * CJ
  139. weld.C0=C0
  140. weld.C1=C1
  141. weld.Parent=hit2
  142. end
  143. ray = function(Pos, Dir,xxz)
  144. local xxz2=c
  145. if xxz ~= nil then
  146. xxz2=nil
  147. end
  148. return workspace:FindPartOnRay(Ray.new(Pos, Dir.unit *999),xxz2)
  149. end
  150. ft2 = function(tablez,item)
  151. for i=1,#tablez do
  152. if tablez[i][1] == item then
  153. return i
  154. end
  155. end
  156. return nil
  157. end
  158. Trail = function(ob,times,waitz,col,thickz,ofz)
  159. q(function()
  160. local oldpos=(ob.CFrame *ofz).p
  161. for i=1,times do
  162. local obp=(ob.CFrame *ofz).p
  163. local mag=(oldpos - obp).magnitude
  164. local tr=pa(ob,"trail","Block",0,0,0,false,false,0.5,0.15,col)
  165. tr.Anchored=true
  166. tr.CFrame=cn(oldpos,obp)
  167. tr.CFrame=tr.CFrame + tr.CFrame.lookVector* (mag/2)
  168. local trm=it("CylinderMesh",tr)
  169. trm.Scale=v3(5*thickz,mag*5,5*thickz)
  170. q(function()
  171. for i=5*thickz,0,-5*thickz/10 do
  172. trm.Scale=v3(i,mag*5,i)
  173. wait()
  174. end
  175. tr:Remove''
  176. end)
  177. tr.CFrame=tr.CFrame *ca(rd(90),0,0)
  178. oldpos=obp wait(waitz)
  179. end
  180. end)
  181. end
  182. qi = function(ttz)
  183. local qii = it(ttz[1],ttz[2])
  184. table.foreach(ttz,function(oi,oi2)
  185. if oi ~= 1 and oi ~= 2 then
  186. qii[oi] = oi2
  187. end
  188. end)
  189. return qii
  190. end
  191. de = function(it,ti) game:service'Debris':AddItem(it,ti) end
  192. GlowMesh = function(anch,meshid2,rootz,mv3,colzz,adjus,l1,l2,l3) q(function()
  193. local spi=pa(rootz,"","Block",1,1,1,false,false,l1,0,colzz) local spim=it("SpecialMesh",spi) if meshid2:lower()=="sphere" then spim.MeshType="Sphere" elseif meshid2:lower()=="block" then spim.MeshType="Brick" else spim.MeshType="FileMesh" spim.MeshId=meshid2 end
  194. if anch then local spiw=qi({"Weld",spi,Part0=rootz,Part1=spi}) spiw.C0 =spiw.C0 *adjus else spi.Anchored=true spi.CFrame=adjus end
  195. for i=l1,l2,l1 do spi.Transparency=i spim.Scale=mv3*(i+0.3) wait() end spi:Remove'' end)
  196. end
  197. DetectSurface = function(pos, part)
  198. local surface = nil
  199. local pospos = part.CFrame
  200. local pos2 = pospos:pointToObjectSpace(pos)
  201. local siz = part.Size
  202. local shaep = part.Shape
  203. if shaep == Enum.PartType.Ball or shaep == Enum.PartType.Cylinder then
  204. surface = {"Anything", cn(pospos.p, pos)*cn(0, 0, -(pospos.p - pos).magnitude+0.12)*ca(rd(-90), 0, 0)}
  205. else
  206. if pos2.Y > ((siz.Y/2)-0.01) then
  207. surface = {"Top", ca(0, 0, 0)}
  208. elseif pos2.Y < -((siz.Y/2)-0.01) then
  209. surface = {"Bottom", ca(-math.pi, 0, 0)}
  210. elseif pos2.X > ((siz.X/2)-0.01) then
  211. surface = {"Right", ca(0, 0, rd(-90))}
  212. elseif pos2.X < -((siz.X/2)-0.01) then
  213. surface = {"Left", ca(0, 0, rd(90))}
  214. elseif pos2.Z > ((siz.Z/2)-0.01) then
  215. surface = {"Back", ca(rd(90), 0, 0)}
  216. elseif pos2.Z < -((siz.Z/2)-0.01) then
  217. surface = {"Front", ca(rd(-90), 0, 0)}
  218. end end
  219. return surface
  220. end
  221. BulletHole = function(HitPos,HitObj,sc)
  222. local Surface = DetectSurface(HitPos, HitObj)
  223. local C = cn(HitPos) * ca(HitObj.CFrame:toEulerAnglesXYZ()) * Surface[2]
  224. if Surface[1] == "Anything" then C = Surface[2] end
  225. local bl = pa(workspace,"","Block",sc,0,sc,false,true,1,0,"") qi({"Decal",bl,Face="Top",Texture=ds.BulletHole})
  226. bl.CFrame = C*cn(0,-0.1,0) if not HitObj.Anchored then bl.Anchored = false stick(bl,HitObj) bl.ChildRemoved:connect(function() bl:Remove() end) end de(bl,5)
  227. end
  228. so = function(id,par,vol,pit) q(function()
  229. local sou = qi({"Sound",par or workspace,Volume=vol/1.5 or 0.75,Pitch=pit or 1,SoundId=id})
  230. wait() sou:play() wait(2) sou:Remove() end) end
  231. GetRegion = function(p0,p1,f,f2)
  232. q(function()
  233. for i,v in pairs(workspace:FindPartsInRegion3(Region3.new(p0,p1),c,100) ) do
  234. if v.Parent:findFirstChild("H") == nil and v.Name == "Torso" and v.Parent:findFirstChild("Humanoid") and v.Parent.Humanoid.Health > 0 and v.Parent:findFirstChild("Torso") then
  235. q(function()
  236. f(v.Parent)
  237. end)
  238. elseif f2 and v.Parent.Parent:findFirstChild("Humanoid") == nil then
  239. f2(v)
  240. end
  241. end
  242. end)
  243. end
  244. FindGround = function(pos)
  245. local ax,ay,az = pos:toEulerAnglesXYZ()
  246. local bhit,bpos=ray(pos.p,pos.p - (pos.p + v3(0,200,0)))
  247. if bhit and bpos then
  248. return cn(bpos)*ca(ax,ay,az)
  249. end
  250. return nil
  251. end
  252. MakeCrater = function(pos,sc,tyms,debz)
  253. q(function()
  254. if not debz then
  255. debz = 5
  256. end
  257. local bhit,bpos=ray(pos,pos - (pos + v3(0,200,0)))
  258. if bhit and bpos then
  259. for i=1,tyms do
  260. q(function()
  261. local gr = pa(misc,"","Block",rn(5,13)/10*sc,0.25*sc,rn(4,10)/10*sc,true,true,bhit.Transparency,bhit.Reflectance,bhit.BrickColor.Name)
  262. gr.Material = bhit.Material
  263. gr.TopSurface = bhit.TopSurface
  264. gr.CFrame = cn(bpos+v3(rn(-12,12)/10*sc,0,rn(-12,12)/10*sc))*ca(rd(rn(-40,40)),rd(rn(-360,360)),rd(rn(-40,40)))
  265. wait(debz)
  266. fade(gr,0.1)
  267. end)
  268. end
  269. end
  270. end)
  271. end
  272. MakeCrack = function(pos,sc,debz)
  273. q(function()
  274. if not debz then
  275. debz = 5
  276. end
  277. local bhit,bpos=ray(pos,pos - (pos + v3(0,10,0)))
  278. if bhit and bpos then
  279. local cr = pa(misc,"","Block",sc,0,sc,false,true,1,0,"") cr.CFrame = cn(bpos)
  280. local dec=qi({"Decal",cr,Face="Top",Texture=ds.Crack}) de(cr,debz)
  281. end
  282. end)
  283. end
  284. f1 = function(cff,hit2,hit)
  285. local HitPos=cff.p
  286. local CJ=cn(HitPos)
  287. local C0=cff:inverse() *CJ
  288. local C1=hit.CFrame:inverse() * CJ
  289. return C0,C1
  290. end
  291. a = {}
  292. a.insw={}
  293. function cleanweld(wexx,namzi)
  294. local tn=ft2(a.insw,wexx)
  295. if tn==nil then return end
  296. if namzi=="p0" then
  297. a.insw[tn][2]["p0x"],a.insw[tn][2]["p0y"],a.insw[tn][2]["p0z"]=0,0,0 elseif namzi=="p1" then
  298. a.insw[tn][2]["p1x"],a.insw[tn][2]["p1y"],a.insw[tn][2]["p1z"]=0,0,0 elseif namzi=="a0" then
  299. a.insw[tn][2]["a0x"],a.insw[tn][2]["a0y"],a.insw[tn][2]["a0z"]=0,0,0 elseif namzi=="a1" then
  300. a.insw[tn][2]["a1x"],a.insw[tn][2]["a1y"],a.insw[tn][2]["a1z"]=0,0,0
  301. end
  302. end
  303. function c2(wexx,smmx,c0orc1,aa,bb,cc,xx,yy,zz)
  304. q(function()
  305. c1(wexx,smmx,c0orc1,aa,bb,cc,xx,yy,zz)
  306. end)
  307. end
  308. a.Welding=0
  309. function c1(wexx,smmx,c0orc1,aa,bb,cc,xx,yy,zz)
  310. if ft2(a.insw,wexx)==nil then
  311. ti(a.insw,{wexx,{}})
  312. local tn=ft2(a.insw,wexx)
  313. a.insw[tn][2]["p0x"],a.insw[tn][2]["p0y"],a.insw[tn][2]["p0z"]=wexx.C0.x,wexx.C0.y,wexx.C0.z
  314. a.insw[tn][2]["p1x"],a.insw[tn][2]["p1y"],a.insw[tn][2]["p1z"]=wexx.C1.x,wexx.C1.y,wexx.C1.z
  315. a.insw[tn][2]["a0x"],a.insw[tn][2]["a0y"],a.insw[tn][2]["a0z"]=wexx.C0:toEulerAnglesXYZ()
  316. a.insw[tn][2]["a1x"],a.insw[tn][2]["a1y"],a.insw[tn][2]["a1z"]=wexx.C1:toEulerAnglesXYZ()
  317. end
  318. local tn=ft2(a.insw,wexx)
  319. local xx2,yy2,zz2=0,0,0
  320. local x2,y2,z2=0,0,0
  321. if c0orc1==0 then
  322. xx2,yy2,zz2=a.insw[tn][2]["a0x"],a.insw[tn][2]["a0y"],a.insw[tn][2]["a0z"]
  323. x2,y2,z2=a.insw[tn][2]["p0x"],a.insw[tn][2]["p0y"],a.insw[tn][2]["p0z"]
  324. elseif c0orc1==1 then
  325. xx2,yy2,zz2=a.insw[tn][2]["a1x"],a.insw[tn][2]["a1y"],a.insw[tn][2]["a1z"]
  326. x2,y2,z2=a.insw[tn][2]["p1x"],a.insw[tn][2]["p1y"],a.insw[tn][2]["p1z"]
  327. else
  328. xx2,yy2,zz2=a.insw[tn][2]["a1x"],a.insw[tn][2]["a1y"],a.insw[tn][2]["a1z"]
  329. x2,y2,z2=a.insw[tn][2]["p0x"],a.insw[tn][2]["p0y"],a.insw[tn][2]["p0z"]
  330. end a.Welding=a.Welding + 1
  331. local twa=1
  332. if smmx >= 1 then
  333. else
  334. for i=smmx,0.8,smmx do
  335. twa = 1
  336. if c0orc1==0 then
  337. wexx.C0=cn(x2-(((x2-aa)/twa)*i),y2-(((y2-bb)/twa)*i),z2-(((z2-cc)/twa)*i)) *ca(xx2-(((xx2-rd(xx))/twa)*i),yy2-(((yy2-rd(yy))/twa)*i),zz2-(((zz2-rd(zz))/twa)*i))
  338. elseif c0orc1==1 then
  339. wexx.C1=cn(x2-(((x2-aa)/twa)*i),y2-(((y2-bb)/twa)*i),z2-(((z2-cc)/twa)*i)) *ca(xx2-(((xx2-rd(xx))/twa)*i),yy2-(((yy2-rd(yy))/twa)*i),zz2-(((zz2-rd(zz))/twa)*i))
  340. else local x,y,z = wexx.C0:toEulerAnglesXYZ()
  341. wexx.C0=cn(x2-(((x2-aa)/twa)*i),y2-(((y2-bb)/twa)*i),z2-(((z2-cc)/twa)*i))*ca(x,y,z)
  342. wexx.C1=cn(wexx.C1.x,wexx.C1.y,wexx.C1.z)*ca(xx2-(((xx2-rd(xx))/twa)*i),yy2-(((yy2-rd(yy))/twa)*i),zz2-(((zz2-rd(zz))/twa)*i))
  343. end
  344. if fu then
  345. q(fu)
  346. end
  347. wait()
  348. end
  349. for i=0.8,1,smmx*0.45 do
  350. twa = 1
  351. if c0orc1==0 then
  352. wexx.C0=cn(x2-(((x2-aa)/twa)*i),y2-(((y2-bb)/twa)*i),z2-(((z2-cc)/twa)*i)) *ca(xx2-(((xx2-rd(xx))/twa)*i),yy2-(((yy2-rd(yy))/twa)*i),zz2-(((zz2-rd(zz))/twa)*i))
  353. elseif c0orc1==1 then
  354. wexx.C1=cn(x2-(((x2-aa)/twa)*i),y2-(((y2-bb)/twa)*i),z2-(((z2-cc)/twa)*i)) *ca(xx2-(((xx2-rd(xx))/twa)*i),yy2-(((yy2-rd(yy))/twa)*i),zz2-(((zz2-rd(zz))/twa)*i))
  355. else local x,y,z = wexx.C0:toEulerAnglesXYZ()
  356. wexx.C0=cn(x2-(((x2-aa)/twa)*i),y2-(((y2-bb)/twa)*i),z2-(((z2-cc)/twa)*i))*ca(x,y,z)
  357. wexx.C1=cn(wexx.C1.x,wexx.C1.y,wexx.C1.z)*ca(xx2-(((xx2-rd(xx))/twa)*i),yy2-(((yy2-rd(yy))/twa)*i),zz2-(((zz2-rd(zz))/twa)*i))
  358. end
  359. wait()
  360. end
  361. end
  362. local i=1
  363. if c0orc1==0 then
  364. wexx.C0=cn(x2-(((x2-aa)/twa)*i),y2-(((y2-bb)/twa)*i),z2-(((z2-cc)/twa)*i)) *ca(xx2-(((xx2-rd(xx))/twa)*i),yy2-(((yy2-rd(yy))/twa)*i),zz2-(((zz2-rd(zz))/twa)*i))
  365. elseif c0orc1==1 then
  366. wexx.C1=cn(x2-(((x2-aa)/twa)*i),y2-(((y2-bb)/twa)*i),z2-(((z2-cc)/twa)*i)) *ca(xx2-(((xx2-rd(xx))/twa)*i),yy2-(((yy2-rd(yy))/twa)*i),zz2-(((zz2-rd(zz))/twa)*i))
  367. else local x,y,z = wexx.C0:toEulerAnglesXYZ()
  368. wexx.C0=cn(x2-(((x2-aa)/twa)*i),y2-(((y2-bb)/twa)*i),z2-(((z2-cc)/twa)*i))*ca(x,y,z)
  369. wexx.C1=cn(wexx.C1.x,wexx.C1.y,wexx.C1.z)*ca(xx2-(((xx2-rd(xx))/twa)*i),yy2-(((yy2-rd(yy))/twa)*i),zz2-(((zz2-rd(zz))/twa)*i))
  370. end
  371. a.Welding=a.Welding - 1
  372. local tn=ft2(a.insw,wexx)
  373. if c0orc1==0 then
  374. a.insw[tn][2]["p0x"],a.insw[tn][2]["p0y"],a.insw[tn][2]["p0z"]=x2-(((x2-aa)/twa)*i),y2-(((y2-bb)/twa)*i),z2-(((z2-cc)/twa)*i)
  375. a.insw[tn][2]["a0x"],a.insw[tn][2]["a0y"],a.insw[tn][2]["a0z"]=xx2-(((xx2-rd(xx))/twa)*i),yy2-(((yy2-rd(yy))/twa)*i),zz2-(((zz2-rd(zz))/twa)*i)
  376. elseif c0orc1==1 then
  377. a.insw[tn][2]["p1x"],a.insw[tn][2]["p1y"],a.insw[tn][2]["p1z"]=x2-(((x2-aa)/twa)*i),y2-(((y2-bb)/twa)*i),z2-(((z2-cc)/twa)*i)
  378. a.insw[tn][2]["a1x"],a.insw[tn][2]["a1y"],a.insw[tn][2]["a1z"]=xx2-(((xx2-rd(xx))/twa)*i),yy2-(((yy2-rd(yy))/twa)*i),zz2-(((zz2-rd(zz))/twa)*i)
  379. elseif c0orc1==3 then
  380. local x,y,z=wexx.C0.x,wexx.C0.y,wexx.C0.z
  381. a.insw[tn][2]["p0x"],a.insw[tn][2]["p0y"],a.insw[tn][2]["p0z"]=x2-(((x2-aa)/twa)*i),y2-(((y2-bb)/twa)*i),z2-(((z2-cc)/twa)*i)
  382. local x,y,z=wexx.C1:toEulerAnglesXYZ()
  383. a.insw[tn][2]["a1x"],a.insw[tn][2]["a1y"],a.insw[tn][2]["a1z"]=xx2-(((xx2-rd(xx))/twa)*i),yy2-(((yy2-rd(yy))/twa)*i),zz2-(((zz2-rd(zz))/twa)*i)
  384. end
  385. end
  386. gunshot = function(speed,sc,dmg,cff) q(function()
  387. local bb = pa(workspace,"","Block",0.2*sc,0.3*sc,0.2*sc,true,true,0,0.1,"Black") qi({"CylinderMesh",bb})
  388. bb.CFrame = cff*ca(rd(rn(-1000,1000)/1500),rd(rn(-1000,1000)/1500),rd(rn(-1000,1000)/1500))
  389. so(ds.Fire,bb,0.3,1) wait() for i=1,50 do
  390. bhit,bpos=ray(bb.Position,bb.Position - (bb.CFrame *cn(0,-1,0)).p)
  391. if bhit and bpos and (bpos - bb.Position).magnitude < speed then break end
  392. bb.CFrame=bb.CFrame*cn(0,speed,0)*ca(rd(-0.2),0,0)
  393. wait()
  394. end bb.CFrame=bb.CFrame*cn(0,(bpos-bb.Position).magnitude,0)
  395. if not bhit.Anchored then
  396. if bhit.Parent:findFirstChild("Humanoid") then local h = bhit.Parent.Humanoid h.Health=h.Health-dmg so(ds.Hit,bhit,0.3,1) end
  397. else end bb:Remove()
  398. if bhit.Parent:findFirstChild("Humanoid") == nil then BulletHole(bpos,bhit,0.7*sc) end
  399. end) end
  400. _G.mm = qi({"Model",workspace,Name="RMTank"})
  401. local mm = _G.mm
  402. engine=pa(mm,"","Block",14,3,20,true,false,0,0,"Bright green") it('BlockMesh',engine)
  403. engine.CFrame = c.Torso.CFrame*cn(0,0,-20)
  404. front=pa(mm,"","Wedge",14,3,3,true,false,0,0,"Bright green")
  405. qi({"Weld",front,Part0=engine,Part1=front,C0=cn(0,0,-11.5)*ca(rd(180),rd(180),0)})
  406. front2=pa(mm,"","Wedge",14,2,6,true,false,0,0,"Bright green")
  407. qi({"Weld",front,Part0=engine,Part1=front2,C0=cn(0,2.5,-10)})
  408. back=pa(mm,"","Wedge",14,5,6,true,false,0,0,"Bright green")
  409. qi({"Weld",front,Part0=engine,Part1=back,C0=cn(0,1,13)*ca(rd(180),rd(0),0)})
  410. body2=pa(mm,"","Block",14,2,17,true,false,0,0,"Bright green") it('BlockMesh',body2)
  411. qi({"Weld",body2,Part0=engine,Part1=body2,C0=cn(0,2.5,1.5)})
  412. body3=pa(mm,"","Wedge",14,1,8,true,false,0,0,"Bright green")
  413. qi({"Weld",body2,Part0=engine,Part1=body3,C0=cn(0,4,12)})
  414. lbody=pa(mm,"","Block",2.3,3,24,true,false,0,0,"Bright green") it('BlockMesh',lbody)
  415. qi({"Weld",body2,Part0=engine,Part1=lbody,C0=cn(8.1,2.5,1.5)})
  416. rbody=pa(mm,"","Block",2.3,3,24,true,false,0,0,"Bright green") it('BlockMesh',rbody)
  417. qi({"Weld",body2,Part0=engine,Part1=rbody,C0=cn(-8.1,2.5,1.5)})
  418. lb=pa(mm,"","Block",2.25,0.4,18,true,false,0,0,"Black") it('BlockMesh',lb)
  419. qi({"Weld",body2,Part0=engine,Part1=lb,C0=cn(8,-2.5,1.5)})
  420. rb=pa(mm,"","Block",2.25,0.4,18,true,false,0,0,"Black") it('BlockMesh',lb)
  421. qi({"Weld",body2,Part0=engine,Part1=rb,C0=cn(-8,-2.5,1.5)})
  422. spi=pa(mm,"","Block",5,3,5,true,false,0,0,"Bright green") it('CylinderMesh',spi)
  423. spiw = qi({"Weld",body2,Part0=engine,Part1=spi,C0=cn(0,5,5)})
  424. spi2=pa(mm,"","Block",12,3,12,true,false,0,0,"Bright green") it('BlockMesh',spi2)
  425. qi({"Weld",body2,Part0=spi,Part1=spi2,C0=cn(0,1,0)})
  426. spi6=pa(mm,"","Wedge",12,3,2,true,false,0,0,"Bright green") it('BlockMesh',spi2)
  427. qi({"Weld",body2,Part0=spi2,Part1=spi6,C0=cn(0,0,7)*ca(rd(180),rd(0),0)})
  428. spi3=pa(mm,"","Wedge",3,6,4,true,false,0,0,"Bright green")
  429. qi({"Weld",body2,Part0=spi2,Part1=spi3,C0=cn(-3,0,-8)*ca(0,0,rd(90))})
  430. spi4=pa(mm,"","Wedge",3,6,4,true,false,0,0,"Bright green")
  431. qi({"Weld",body2,Part0=spi2,Part1=spi4,C0=cn(3,0,-8)*ca(0,0,rd(-90))})
  432. tilt=pa(mm,"","Block",5,3,5,true,false,0,0,"Bright green") it('CylinderMesh',tilt)
  433. tiltw=qi({"Weld",body2,Part0=spi2,Part1=tilt,C0=cn(0,0.5,-8.5)*ca(0,0,rd(90))})
  434. can=pa(mm,"","Block",2,20,2,true,false,0,0,"Bright green") it('CylinderMesh',can)
  435. canw=qi({"Weld",body2,Part0=tilt,Part1=can,C0=cn(0,0,-11)*ca(rd(-90),0,0)})
  436. can2=pa(mm,"","Block",3.4,1.5,3.4,true,false,0,0,"Bright green") it('CylinderMesh',can2)
  437. qi({"Weld",body2,Part0=can,Part1=can2,C0=cn(0,-4,0)})
  438. can5=pa(mm,"","Block",2.4,1.5,2.4,true,false,0,0,"Bright green") it('CylinderMesh',can5)
  439. qi({"Weld",body2,Part0=can,Part1=can5,C0=cn(0,9,0)})
  440. can3=pa(mm,"","Block",2.5,10,2.5,true,false,0,0,"Bright green") it('CylinderMesh',can3)
  441. qi({"Weld",body2,Part0=can,Part1=can3,C0=cn(0,-5,0)})
  442. can4=pa(mm,"","Block",3,4,3,true,false,0,0,"Bright green") it('CylinderMesh',can4)
  443. qi({"Weld",body2,Part0=can,Part1=can4,C0=cn(0,1,0)})
  444. hol=pa(mm,"","Block",1.75,0,1.75,true,false,0,0,"Really black") it('CylinderMesh',hol)
  445. qi({"Weld",body2,Part0=can,Part1=hol,C0=cn(0,10,0)})
  446. smo = qi({"Smoke",hol,RiseVelocity=25,Size=8,Color=BrickColor.new("White").Color,Opacity=0.1,Enabled=false})
  447. hol2=pa(mm,"","Block",0,0,0,true,false,0,0,"Really black") it('CylinderMesh',hol2).Scale=v3(5,0.2,5)*5
  448. qi({"Weld",body2,Part0=spi2,Part1=hol2,C0=cn(0,1.5,4)})
  449. cap=pa(mm,"","Block",5.1,0,5.1,true,false,0,0,"Brick blue") it('CylinderMesh',cap)
  450. capw = qi({"Weld",body2,Part0=hol2,Part1=cap,C0=cn(0,0.1,2.5),C1=cn(0,0,2.5)})
  451. aaa=pa(mm,"","Block",3,0.5,0.5,true,false,0,0,"Brick blue")
  452. qi({"Weld",body2,Part0=hol2,Part1=aaa,C0=cn(0,0,2.5)})
  453. aaa2=pa(mm,"","Block",5,0.5,5,true,false,0,0,"Bright green") it('CylinderMesh',aaa2)
  454. aaa2w=qi({"Weld",body2,Part0=spi2,Part1=aaa2,C0=cn(-3.4,1.7,-4.6)*ca(0,rd(35),0)})
  455. lb.Friction = 0.045
  456. rb.Friction = 0.045
  457. for x=-5,5,10/3 do
  458. aaax=pa(mm,"","Block",2,3.5,2,true,false,0,0,"")
  459. qi({"Weld",body2,Part0=spi2,Part1=aaax,C0=cn(x,0,7.5)*ca(rd(80),0,0)}) it('CylinderMesh',aaax)
  460. end
  461. for x=-1,1 do
  462. aaa=pa(mm,"","Block",x~=0 and 3 or 2,3,0.5,true,false,0,0,"Bright green")
  463. qi({"Weld",body2,Part0=aaa2,Part1=aaa,C0=cn(x*2,1.6,x~=0 and -1 or -2)*ca(0,rd(-45*x),0)})
  464. if x==0 then
  465. ball=pa(mm,"","Block",0,0,0,true,false,0,0,"Bright green") qi({"SpecialMesh",ball,MeshType="Sphere",Scale=v3(1.7,1,1)*7})
  466. ballw=qi({"Weld",body2,Part0=aaa,Part1=ball,C0=cn(0,1.5,0)})
  467. gun1=pa(mm,"","Block",0.5,2,0.5,true,false,0,0,"Bright green") it('CylinderMesh',gun1)
  468. qi({"Weld",body2,Part0=ball,Part1=gun1,C0=cn(-0.4,0,-1)*ca(rd(-90),0,0)})
  469. gun2=pa(mm,"","Block",0.5,2,0.5,true,false,0,0,"Bright green") it('CylinderMesh',gun2)
  470. qi({"Weld",body2,Part0=ball,Part1=gun2,C0=cn(0.4,0,-1)*ca(rd(-90),0,0)})
  471. for i,v in pairs({gun1,gun2}) do
  472. gunhol=pa(mm,"","Block",0.3,0,0.3,true,false,0,0,"Really black") it('CylinderMesh',gunhol)
  473. qi({"Weld",body2,Part0=v,Part1=gunhol,C0=cn(0,0.92,0)})
  474. end
  475. seat2=pa(mm,"","VehicleSeat",2,0.5,2,true,false,0,0,"Bright green") it('CylinderMesh',seat2)
  476. seat2w=qi({"Weld",body2,Part0=aaa2,Part1=seat2,C0=cn(0,0.5,0)})
  477. seat2.HeadsUpDisplay=false
  478. q(function()
  479. local guntilt = 0
  480. for i,v in pairs({aaa2,ball,seat2}) do
  481. local gcd = qi({"ClickDetector",v,MaxActivationDistance=8})
  482. gcd.MouseClick:connect(function()
  483. gunshot(10,1,5,gun1.CFrame*cn(0,1+(rn(0,2000)/600),0))
  484. gunshot(10,1,5,gun2.CFrame*cn(0,1+(rn(0,2000)/600),0))
  485. end)
  486. end
  487. while true do if rn(1,8) == 1 then wait() else wait(0.0345) end
  488. aaa2w.C1=aaa2w.C1*ca(0,rd(seat2.Steer*6),0)
  489. if seat2.Throttle == 1 and guntilt<112 then guntilt = guntilt+4
  490. elseif seat2.Throttle == -1 and guntilt>-48 then guntilt=guntilt-4
  491. --elseif seat2.Throttle==0 then if guntilt > 0 then guntilt=guntilt-4 elseif guntilt<0 then guntilt=guntilt+4 end
  492. end
  493. ballw.C1=ca(rd(-guntilt),0,0)
  494. end
  495. end)
  496. end
  497. end
  498. for x=-1,1,2 do
  499. for z=-1,1,2 do
  500. whe=pa(mm,"","Block",4,2,4,true,false,0,0,"Black") qi({"CylinderMesh",whe})
  501. qi({"Weld",whe,Part0=engine,Part1=whe,C0=cn(x*8,0.8,(z*11.5)+1.5)*ca(0,0,rd(90))})
  502. ss=pa(mm,"","Block",2.25,0.3,5,true,false,0,0,"Black")
  503. qi({"Weld",body2,Part0=engine,Part1=ss,C0=cn(x*8,-1.5,(z*11.2)+1.5)*ca(rd(-23*z),0,0)})
  504. ss=pa(mm,"","Block",2.25,2,0.3,true,false,0,0,"Black")
  505. qi({"Weld",body2,Part0=engine,Part1=ss,C0=cn(x*8,0.4,(z*13.4)+1.5)})
  506. ss=pa(mm,"","Wedge",2.3,3,3,true,false,0,0,"Bright green")
  507. local trolo = z == 1 and 180 or 0
  508. qi({"Weld",body2,Part0=engine,Part1=ss,C0=cn(x*8.1,2.5,(z*13.5)+1.5)*ca(0,rd(trolo),0)})
  509. end end
  510. local form = 4*4
  511. for x=-1,1,2 do
  512. for z=form/2,-form/2,-form/3 do
  513. whe=pa(mm,"","Block",4,2,4,true,false,0,0,"Black") qi({"CylinderMesh",whe})
  514. qi({"Weld",whe,Part0=engine,Part1=whe,C0=cn(8*x,-0.5,(z*0.9)+1.5)*ca(0,0,rd(90))})
  515. end
  516. end
  517. for i,p in pairs(mm:children()) do if p.BrickColor.Name=="Bright green" then
  518. for i,s in pairs({"Back","Front","Bottom","Top","Left","Right"}) do
  519. --qi({"Texture",p,Face=s,Texture=ds.Camo,StudsPerTileU=0,StudsPerTileV=0})
  520. end
  521. end end
  522. game.Lighting.Ambient=Color3.new(1,1,1)
  523. local bin = qi({"HopperBin",bp,Name="RMTank"})
  524. t = {}
  525. t.Vault = "Closed"
  526. t.Steer = ""
  527. t.Steer2 = ""
  528. t.Steering=""
  529. t.Tilt = 0
  530. t.Move = ""
  531. t.Fire = false
  532. ks = {}
  533. TheWeld = nil
  534. Seated = false
  535. TankSpeed=16
  536. bv = qi({"BodyVelocity",engine}) bv.maxForce=v3(0,0,0)
  537. bav = qi({"BodyAngularVelocity",engine}) bav.maxTorque=v3(0,0,0)
  538. bin.Selected:connect(function(mouse)
  539. mouse.KeyDown:connect(function(k) k = k:lower() ks[k]=false
  540. if k == "g" and t.Vault~="moving" then if t.Vault=="Closed" then
  541. t.Vault = "moving" for i=0,-110,-10 do capw.C1=cn(0,0,2.5)*ca(rd(i),0,0) wait(0.034) end t.Vault="Opened" else
  542. t.Vault = "moving" for i=-110,0,10 do capw.C1=cn(0,0,2.5)*ca(rd(i),0,0) wait(0.034) end t.Vault="Closed" end
  543. elseif k == "h" and t.Steer=="" then t.Steer = "Left" repeat spiw.C1=spiw.C1*ca(0,rd(-2),0) wait(0.034) until ks[k] t.Steer = ""
  544. elseif k == "k" and t.Steer=="" then t.Steer = "Right" repeat spiw.C1=spiw.C1*ca(0,rd(2),0) wait(0.034) until ks[k] t.Steer = ""
  545. elseif k == "u" and t.Steer2=="" then t.Steer2 = "Up" repeat t.Tilt=t.Tilt+1.5 tiltw.C1=ca(0,rd(t.Tilt),0) wait(0.034) until t.Tilt>=90 or ks[k] t.Steer2 = ""
  546. elseif k == "j" and t.Steer2=="" then t.Steer2 = "Down" repeat t.Tilt=t.Tilt-1.5 tiltw.C1=ca(0,rd(t.Tilt),0) wait(0.034) until t.Tilt<=-12 or ks[k] t.Steer2 = ""
  547. elseif k == "z" and t.Vault=="Opened" and Seated and TheWeld then Seated = false TheWeld:Remove() c.Humanoid.PlatformStand = false c.Torso.CFrame = hol2.CFrame*cn(0,4,0) mm.Parent = workspace
  548. elseif k == "w" and Seated and t.Move == "" then t.Move = "Forward" bv.maxForce=v3(1/0,0,1/0) repeat bv.velocity=engine.CFrame.lookVector*TankSpeed wait() until ks[k] bv.maxForce=v3(0,0,0) t.Move = ""
  549. elseif k == "s" and Seated and t.Move == "" then t.Move = "Backward" bv.maxForce=v3(1/0,0,1/0) repeat bv.velocity=engine.CFrame.lookVector*(-TankSpeed/1.2) wait() until ks[k] bv.maxForce=v3(0,0,0) t.Move = ""
  550. elseif k == "a" and Seated and t.Steering=="" then t.Steering="Left" bav.maxTorque=v3(0,1/0,0) bav.angularvelocity=v3(0,0.8,0) repeat wait() until ks[k] bav.maxTorque=v3(0,0,0) t.Steering = ""
  551. elseif k == "d" and Seated and t.Steering=="" then t.Steering="Right" bav.maxTorque=v3(0,1/0,0) bav.angularvelocity=v3(0,-0.8,0) repeat wait() until ks[k] bav.maxTorque=v3(0,0,0) t.Steering = ""
  552. elseif k == "f" and not t.Fire then t.Fire = true
  553. q(function()
  554. GlowMesh(false,ds.Ring,hol,v3(7,7,7),'New Yeller',hol.CFrame*cn(0,0,0)*ca(rd(90),0,0),0.1,1,0.13)
  555. local speed = 8 local cff = hol.CFrame*cn(0,2,0) local dmg = 25
  556. local bb = pa(mm,"","Block",2,2,2,true,true,0,0.2,"Black") qi({"CylinderMesh",bb})
  557. local bb2 = pa(mm,"","Block",0,0,0,true,true,0,0.2,"Black") qi({"SpecialMesh",bb2,MeshType="Sphere",Scale=v3(2,3,2)*5})
  558. bb.CFrame = cff*ca(rd(rn(-1000,1000)/1500),rd(rn(-1000,1000)/1500),rd(rn(-1000,1000)/1500))
  559. so(ds.Fire,bb,0.3,1) wait() for i=1,50 do bb2.CFrame = bb.CFrame*cn(0,-5,0)
  560. bhit,bpos=ray(bb.Position,bb.Position - (bb.CFrame *cn(0,-1,0)).p)
  561. if bhit and bpos and (bpos - bb.Position).magnitude < speed then break end
  562. bb.CFrame=bb.CFrame*cn(0,speed,0)*ca(0,0,rd(0.2)) bb2.CFrame=bb.CFrame*cn(0,1,0)
  563. wait()
  564. end bb.CFrame=bb.CFrame*cn(0,(bpos-bb.Position).magnitude,0)
  565. bb:Remove() bb2:Remove()
  566. for i=1,3 do
  567. GlowMesh(false,"Sphere",hol,v3(rn(10,20),rn(10,20),rn(10,20)),'New Yeller',bb.CFrame*cn(rn(-3,3),rn(-3,3),rn(-3,3))*ca(rd(rn(-360,360)),rd(rn(-360,360)),rd(rn(-360,360))),0.1,1,0.1) end
  568. local rr = 10 GetRegion(bb.Position-v3(rr,rr,rr),bb.Position+v3(rr,rr,rr),function(v) if v.Name~="Torso" then return end v.Humanoid.Health=b.Humanoid.Health-dmg end,function(v) if v.Anchored or v:GetMass()>500 then return end v:BreakJoints() v.Velocity=cn(bb.Position,v.Position).lookVector*rn(70,120) end)
  569. end)
  570. smo.Enabled = true for i=0,-3,-1 do canw.C1=cn(0,-i/1.3,0) wait(0.033) end for i=-3,0,1 do canw.C1=cn(0,-i/1.3,0) wait(0.033) end
  571. smo.Enabled = false t.Fire = false
  572. end
  573. end)
  574. mouse.KeyUp:connect(function(k) k=k:lower() ks[k]=true
  575. end)
  576. end)
  577. hol2.Touched:connect(function(hit) if hit.Parent ~= c or Seated or t.Vault~="Opened" then return end
  578. _G.mm.Parent = c Seated = true
  579. local hu = c.Humanoid hu.PlatformStand = true wait()
  580. TheWeld = qi({"Weld",engine,Part0=engine,Part1=c.Torso,C0=cn(0,1.5,2)*ca(rd(90),0,0)})
  581. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement