Axtem

Mantis

Jun 11th, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 47.27 KB | None | 0 0
  1. _G.mantisReload = function()
  2.  
  3. local plr = game:service'Players'.LocalPlayer
  4. local pg = plr:WaitForChild("PlayerGui")
  5. local mouse = plr:GetMouse()
  6. local char = plr.Character
  7. local root = char:WaitForChild'HumanoidRootPart'
  8. local head = char:WaitForChild'Head'
  9. local tor = char:WaitForChild'Torso'
  10. local la,ra = char["Left Arm"],char["Right Arm"]
  11. local ll,rl = char["Left Leg"],char["Right Leg"]
  12. tor.CFrame = tor.CFrame + Vector3.new(0,5,0)
  13.  
  14. local hum = char.Humanoid
  15. local step = game:GetService("RunService").RenderStepped
  16.  
  17. pcall(function() workspace["vmodel"..plr.xXcoolrockitXx]:Destroy() end)
  18. pcall(function() pg.bgui:Destroy() end)
  19. if not script:IsA("ModuleScript") then
  20. pcall(function() script.Parent.vehicularScript:Destroy() end)
  21. script.Name = "vehicularScript"
  22. end
  23.  
  24. local sg = Instance.new("ScreenGui",pg)
  25. sg.Name = "bgui"
  26. local p = Instance.new("ImageLabel",sg)
  27. p.Size = UDim2.new(0,6,0,6)
  28. p.Position = UDim2.new(.5,-3,.5,-3)
  29. p.BackgroundColor3 = Color3.new(1,1,1)
  30. p.BackgroundTransparency = .6
  31. local p2 = p:Clone()
  32. p2.Parent = sg
  33. p2.Rotation = 45
  34. local m = Instance.new("Model",workspace)
  35. m.Name = "vmodel"..plr.Name
  36. Instance.new("Humanoid",m).Name = "Shadow"
  37. local hval = Instance.new("NumberValue",m)
  38. hval.Value = 100
  39. hval.Name = "hp"
  40.  
  41. function weld(a,b,c,d)
  42. local w = Instance.new("Motor6D",a)
  43. w.Part0,w.Part1,w.C0,w.C1 = a,b,c or CFrame.new(),d or CFrame.new()
  44. return w
  45. end
  46.  
  47. do
  48. local function QuaternionFromCFrame(cf)
  49. local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
  50. local trace = m00 + m11 + m22
  51. if trace > 0 then
  52. local s = math.sqrt(1 + trace)
  53. local recip = 0.5/s
  54. return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5
  55. else
  56. local i = 0
  57. if m11 > m00 then
  58. i = 1
  59. end
  60. if m22 > (i == 0 and m00 or m11) then
  61. i = 2
  62. end
  63. if i == 0 then
  64. local s = math.sqrt(m00-m11-m22+1)
  65. local recip = 0.5/s
  66. return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip
  67. elseif i == 1 then
  68. local s = math.sqrt(m11-m22-m00+1)
  69. local recip = 0.5/s
  70. return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip
  71. elseif i == 2 then
  72. local s = math.sqrt(m22-m00-m11+1)
  73. local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip
  74. end
  75. end
  76. end
  77. local function QuaternionToCFrame(px, py, pz, x, y, z, w)
  78. local xs, ys, zs = x + x, y + y, z + z
  79. local wx, wy, wz = w*xs, w*ys, w*zs
  80. local xx = x*xs
  81. local xy = x*ys
  82. local xz = x*zs
  83. local yy = y*ys
  84. local yz = y*zs
  85. local zz = z*zs
  86. return CFrame.new(px, py, pz,1-(yy+zz), xy - wz, xz + wy,xy + wz, 1-(xx+zz), yz - wx, xz - wy, yz + wx, 1-(xx+yy))
  87. end
  88. local function QuaternionSlerp(a, b, t)
  89. local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]
  90. local startInterp, finishInterp;
  91. if cosTheta >= 0.0001 then
  92. if (1 - cosTheta) > 0.0001 then
  93. local theta = math.acos(cosTheta)
  94. local invSinTheta = 1/math.sin(theta)
  95. startInterp = math.sin((1-t)*theta)*invSinTheta
  96. finishInterp = math.sin(t*theta)*invSinTheta
  97. else
  98. startInterp = 1-t
  99. finishInterp = t
  100. end
  101. else
  102. if (1+cosTheta) > 0.0001 then
  103. local theta = math.acos(-cosTheta)
  104. local invSinTheta = 1/math.sin(theta)
  105. startInterp = math.sin((t-1)*theta)*invSinTheta
  106. finishInterp = math.sin(t*theta)*invSinTheta
  107. else
  108. startInterp = t-1
  109. finishInterp = t
  110. end
  111. end
  112. return a[1]*startInterp + b[1]*finishInterp, a[2]*startInterp + b[2]*finishInterp, a[3]*startInterp + b[3]*finishInterp, a[4]*startInterp + b[4]*finishInterp
  113. end
  114. function clerp(a,b,t)
  115. local qa = {QuaternionFromCFrame(a)}
  116. local qb = {QuaternionFromCFrame(b)}
  117. local ax, ay, az = a.x, a.y, a.z
  118. local bx, by, bz = b.x, b.y, b.z
  119. local _t = 1-t
  120. return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t))
  121. end
  122. end
  123.  
  124. function lerp(a,b,t)
  125. return a+(b-a)*t
  126. end
  127.  
  128. local cancollide = true
  129. local par = m
  130. function Part(Part0,C0,C1,Size,Color,Ref,Trans,Mesh,Material)
  131. local p = Instance.new("Part",par)
  132. p.FormFactor = "Custom"
  133. p.TopSurface,p.BottomSurface,p.BackSurface,p.FrontSurface,p.RightSurface,p.LeftSurface = 10,10,10,10,10,10
  134. p.Size = Size or Vector3.new()
  135. p.Material = "SmoothPlastic"
  136. p.CanCollide = cancollide
  137. p.Locked = true
  138. if p.Size ~= Size or Mesh then
  139. local bm = Mesh or Instance.new("BlockMesh")
  140. bm.Parent = p
  141. bm.Scale = Size/p.Size*bm.Scale
  142. bm.Parent = p
  143. end
  144. p.BrickColor = Color or BrickColor.new(1001)
  145. p.Reflectance = Ref or 0
  146. p.Transparency = Trans or 0
  147. p.Material = Material or p.Material
  148. local w;
  149. if Part0 then
  150. w = weld(Part0,p,C0,C1)
  151. end
  152. return p,w
  153. end
  154.  
  155. function Mesh(type,scale,arg1,arg2,arg3,arg4,arg5)
  156. local m = Instance.new(type)
  157. m.Scale = scale or Vector3.new(1,1,1)
  158. if type == "SpecialMesh" then
  159. m.MeshType = arg1
  160. if arg1=="FileMesh" then
  161. m.MeshId = arg2 or m.MeshId
  162. m.TextureId = arg3 or m.TextureId
  163. m.Offset = arg4 or m.Offset
  164. m.VertexColor = arg5 or m.VertexColor
  165. else
  166. m.VertexColor = arg3 or m.VertexColor
  167. m.Offset = arg2 or m.Offset
  168. end
  169. else
  170. m.Offset = arg1 or m.Offset
  171. m.VertexColor = arg2 or m.VertexColor
  172. end
  173. return m
  174. end
  175.  
  176. local b = BrickColor.new
  177. local cols = {b(21),b(23),b(141),b(104),b(106),b(24),b(9),b(5)}
  178. function gcol(plr)
  179. if teamColorsEnabled and pcall(function() assert(plr.AccountAge ~= nil) end) and not plr.Neutral then
  180. return plr.TeamColor.Color
  181. else
  182. local v=0;
  183. local n=tostring(plr);
  184. local a=#n;
  185. for i in n:gmatch(".") do
  186. v = v + ((a+(#n%2==1 and -1 or 0))%4 > 1 and -1 or 1)*i:byte()
  187. a = a - 1
  188. end
  189. return cols[(v%8)+1].Color
  190. end
  191. end
  192.  
  193.  
  194. local body = BrickColor.new("Really black")
  195. local body2 = BrickColor.new("Institutional white")
  196. local body3 = BrickColor.new("Really black")
  197. local bodyref = .2
  198. local body2ref = .2
  199. local body3ref = .5
  200.  
  201. local pipe = BrickColor.new("Dark stone grey")
  202. local pipe2 = body2--BrickColor.new("Institutional white")
  203. local pipe3 = body--BrickColor.new("Really black")
  204. local piperef = .25
  205. local pipe2ref = .2
  206. local pipe3ref = .25
  207.  
  208. hum.Sit = true
  209.  
  210.  
  211. local fc = Instance.new("Model",m)
  212. par = fc
  213. local tr = Part(tor,CFrame.new(),CFrame.new(),Vector3.new(),BrickColor.new(),0,1)
  214. tr.Name = "Torso"
  215. Part(tr,CFrame.new(),CFrame.new(),Vector3.new(),BrickColor.new(),0,1).Name = "Head"
  216. Part(ra,CFrame.new(),CFrame.new(),Vector3.new(),ra.BrickColor,0,0).Name = "Right Arm"
  217. Part(la,CFrame.new(),CFrame.new(),Vector3.new(),la.BrickColor,0,0).Name = "Left Arm"
  218. Part(rl,CFrame.new(),CFrame.new(),Vector3.new(),rl.BrickColor,0,0).Name = "Right Leg"
  219. Part(ll,CFrame.new(),CFrame.new(),Vector3.new(),ll.BrickColor,0,0).Name = "Left Leg"
  220. local hm = Instance.new("Humanoid",fc)
  221. hm.MaxHealth = math.huge
  222. hm.PlatformStand = true
  223. for i,v in pairs(char:GetChildren()) do
  224. if v:IsA("Clothing") or v:IsA("CharacterMesh") then
  225. v:Clone().Parent = fc
  226. if v:IsA("Shirt") then
  227. pcall(game.Destroy,tr:FindFirstChild("Mesh"))
  228. pcall(game.Destroy,fc["Right Arm"]:FindFirstChild("Mesh"))
  229. pcall(game.Destroy,fc["Left Arm"]:FindFirstChild("Mesh"))
  230. elseif v:IsA("Pants") then
  231. pcall(game.Destroy,tr:FindFirstChild("Mesh"))
  232. pcall(game.Destroy,fc["Right Leg"]:FindFirstChild("Mesh"))
  233. pcall(game.Destroy,fc["Left Leg"]:FindFirstChild("Mesh"))
  234. end
  235. end
  236. end
  237. local h = Instance.new("Hat",fc)
  238. par = h
  239. Part(tr,CFrame.new(),CFrame.new(),Vector3.new(),BrickColor.new(),0,1).Name = "Handle"
  240. par = m
  241.  
  242. local main,mainweld = Part(tor,CFrame.new(0,-2.25,0)*CFrame.Angles(0,0,0),CFrame.new(0,0,0),Vector3.new(3,1,2),body,bodyref,0)
  243. Part(main,CFrame.new(0,.5,-.4),CFrame.new(),Vector3.new(2.3,.2,1.3),body2,0,0)
  244. local p = Part(main,CFrame.new(0,-.5,1)*CFrame.Angles(-1.4,0,0)*CFrame.new(0,.5,1.25),CFrame.new(),Vector3.new(2.3,.75,2.5),body,bodyref)
  245. Part(p,CFrame.new(0,.375,0),CFrame.new(),Vector3.new(2.2,.2,1.4),body2,0,0)
  246. p = Part(p,CFrame.new(0,-.375,1.25)*CFrame.Angles(-.15,0,0)*CFrame.new(0,.375,.8),CFrame.new(),Vector3.new(2.3,.75,1.6),body,bodyref)
  247. p.CanCollide = false
  248. Part(p,CFrame.new(0,.375,0),CFrame.new(),Vector3.new(2.2,.2,1.2),body2,0,0).CanCollide = false
  249. local back = Part(main,CFrame.new(0,1.4,1)*CFrame.Angles(.15,math.pi,0),CFrame.new(),Vector3.new(2,2,3),body,bodyref,0,Mesh("SpecialMesh",Vector3.new(3,3.8,6.5),"FileMesh","rbxassetid://9944765"))
  250. Part(main,CFrame.new(0,-.5,1.75)*CFrame.Angles(-1.1,0,0)*CFrame.new(0,.5,1.25),CFrame.new(),Vector3.new(1.75,1.5,2.25),body,bodyref)
  251. Part(main,CFrame.new(0,0,1.25),CFrame.new(),Vector3.new(1.75,1.1,1.5),body,bodyref)
  252. local p = Part(main,CFrame.new(0,.5,-1)*CFrame.Angles(-.2,0,0)*CFrame.new(0,-.375,-.5),CFrame.new(),Vector3.new(2.75,.75,1),body,bodyref)
  253. Part(p,CFrame.new(0,.375,.05),CFrame.new(),Vector3.new(2.3,.2,.95),body2,0,0)
  254. Part(p,CFrame.new(0,.8,-.45),CFrame.new(),Vector3.new(2.3,1,.3),body2,0,0)
  255. Part(p,CFrame.new(0,1.5,-.4)*CFrame.Angles(.2,0,0),CFrame.new(),Vector3.new(2.3,.5,.3),body2,0,0)
  256. local p = Part(main,CFrame.new(0,2.1,-2.9)*CFrame.Angles(.9,0,0),CFrame.new(),Vector3.new(1.5,2.5,1),body,bodyref,0)
  257. local p = Part(p,CFrame.new(0,1.25,.5)*CFrame.Angles(-.9,0,0)*CFrame.new(0,.5,-.7),CFrame.new(),Vector3.new(1.501,1,1.4),body,bodyref,0)
  258. local h = Part(p,CFrame.new(.4,-.2,.7)*CFrame.Angles(0,1.425,0)*CFrame.new(.175,0,.9),CFrame.new(),Vector3.new(.35,.35,1.8),body,bodyref,0)
  259. Part(h,CFrame.new(0,0,.225),CFrame.new(),Vector3.new(.4,.4,1.3),body2,body2ref,0)
  260. Part(h,CFrame.new(0,0,.9),CFrame.new(),Vector3.new(.45,.45,.1),body3,body3ref,0)
  261. Part(h,CFrame.new(0,0,-.45),CFrame.new(),Vector3.new(.425,.425,.1),body3,body3ref,0)
  262. Part(h,CFrame.new(0,0,.75),CFrame.new(),Vector3.new(.415,.415,.025),body3,body3ref,0)
  263. Part(h,CFrame.new(0,0,.6),CFrame.new(),Vector3.new(.415,.415,.025),body3,body3ref,0)
  264. Part(h,CFrame.new(0,0,.45),CFrame.new(),Vector3.new(.415,.415,.025),body3,body3ref,0)
  265. Part(h,CFrame.new(0,0,.3),CFrame.new(),Vector3.new(.415,.415,.025),body3,body3ref,0)
  266. Part(h,CFrame.new(0,0,.15),CFrame.new(),Vector3.new(.415,.415,.025),body3,body3ref,0)
  267. Part(h,CFrame.new(0,0,0),CFrame.new(),Vector3.new(.415,.415,.025),body3,body3ref,0)
  268. Part(h,CFrame.new(0,0,-.15),CFrame.new(),Vector3.new(.415,.415,.025),body3,body3ref,0)
  269. Part(h,CFrame.new(0,0,-.3),CFrame.new(),Vector3.new(.415,.415,.025),body3,body3ref,0)
  270. local h = Part(p,CFrame.new(-.4,-.2,.7)*CFrame.Angles(0,-1.425,0)*CFrame.new(-.175,0,.9),CFrame.new(),Vector3.new(.35,.35,1.8),body,bodyref,0)
  271. Part(h,CFrame.new(0,0,.225),CFrame.new(),Vector3.new(.4,.4,1.3),body2,body2ref,0)
  272. Part(h,CFrame.new(0,0,.9),CFrame.new(),Vector3.new(.45,.45,.1),body3,body3ref,0)
  273. Part(h,CFrame.new(0,0,-.45),CFrame.new(),Vector3.new(.425,.425,.1),body3,body3ref,0)
  274. Part(h,CFrame.new(0,0,.75),CFrame.new(),Vector3.new(.415,.415,.025),body3,body3ref,0)
  275. Part(h,CFrame.new(0,0,.6),CFrame.new(),Vector3.new(.415,.415,.025),body3,body3ref,0)
  276. Part(h,CFrame.new(0,0,.45),CFrame.new(),Vector3.new(.415,.415,.025),body3,body3ref,0)
  277. Part(h,CFrame.new(0,0,.3),CFrame.new(),Vector3.new(.415,.415,.025),body3,body3ref,0)
  278. Part(h,CFrame.new(0,0,.15),CFrame.new(),Vector3.new(.415,.415,.025),body3,body3ref,0)
  279. Part(h,CFrame.new(0,0,0),CFrame.new(),Vector3.new(.415,.415,.025),body3,body3ref,0)
  280. Part(h,CFrame.new(0,0,-.15),CFrame.new(),Vector3.new(.415,.415,.025),body3,body3ref,0)
  281. Part(h,CFrame.new(0,0,-.3),CFrame.new(),Vector3.new(.415,.415,.025),body3,body3ref,0)
  282.  
  283. local e = Part(main,CFrame.new(0,1,-4.6)*CFrame.Angles(-.2,-math.pi/2,0)*CFrame.new(0,-.2,0),CFrame.new(),Vector3.new(5,5,5),body,bodyref,0,Mesh("SpecialMesh",Vector3.new(1,1,1),"Cylinder"))
  284. p = Part(e,CFrame.new(-2.25,2.25,0)*CFrame.Angles(0,-math.pi/2,0)*CFrame.Angles(-.05,0,0),CFrame.new(),Vector3.new(2,2,3),body,bodyref,0,Mesh("SpecialMesh",Vector3.new(2,1.75,9.5),"FileMesh","rbxassetid://9944765"))
  285. p = Part(p,CFrame.new(0,-.2,.4)*CFrame.Angles(0,0,0)*CFrame.Angles(-.175,0,0),CFrame.new(),Vector3.new(1,1,1),body2,body2ref,0,Mesh("SpecialMesh",Vector3.new(2.3,2.3,2),"FileMesh","rbxassetid://9944765"))
  286.  
  287. p = Part(e,CFrame.new(2,.25,2)*CFrame.Angles(1.35,math.pi/2,0)*CFrame.Angles(0,0,0),CFrame.new(),Vector3.new(2,2,3),body,bodyref,0,Mesh("SpecialMesh",Vector3.new(2.5,2.5,9.5),"FileMesh","rbxassetid://9944765"))
  288. p = Part(p,CFrame.new(0,.2,-4.55)*CFrame.Angles(0,math.pi,-.1),CFrame.new(),Vector3.new(1,1,1),body,bodyref,0,Mesh("SpecialMesh",Vector3.new(1.6,1.1,9),"FileMesh","rbxassetid://9944765"))
  289.  
  290. p = Part(e,CFrame.new(2,.25,-2)*CFrame.Angles(-1.35,math.pi/2,0)*CFrame.Angles(0,0,0),CFrame.new(),Vector3.new(2,2,3),body,bodyref,0,Mesh("SpecialMesh",Vector3.new(2.5,2.5,9.5),"FileMesh","rbxassetid://9944765"))
  291. p = Part(p,CFrame.new(0,.2,-4.55)*CFrame.Angles(0,math.pi,-.1),CFrame.new(),Vector3.new(1,1,1),body,bodyref,0,Mesh("SpecialMesh",Vector3.new(1.6,1.1,9),"FileMesh","rbxassetid://9944765"))
  292.  
  293.  
  294.  
  295. local e2 = Part(e,CFrame.new(-2.5,0,0)*CFrame.Angles(0,math.pi/2,0),CFrame.new(),Vector3.new(5,5,1),body,bodyref,0,Mesh("SpecialMesh",Vector3.new(1,1,1),"Sphere"))
  296. local et = Part(e2,CFrame.new(0,.05,-.6)*CFrame.Angles(-math.pi/2+.05,0,0),CFrame.new(),Vector3.new(5,5,1),body,bodyref,0,Mesh("SpecialMesh",Vector3.new(3.45,5,3.45),"FileMesh","rbxassetid://16659502"))
  297. local g1 = Part(et,CFrame.new(0,-.5,0)*CFrame.Angles(math.pi/2,0,0),CFrame.new(),Vector3.new(2.5,2.5,2.5),body2,body2ref,0,Mesh("SpecialMesh",Vector3.new(1,1,1),"Sphere"))
  298. local g2 = Part(g1,CFrame.new(0,0,-1)*CFrame.Angles(.15,math.pi/2,0),CFrame.new(),Vector3.new(.75,.6,.6),body2,body2ref,0,Mesh("SpecialMesh",Vector3.new(1,1,1),"Cylinder"))
  299. local t1 = Part(g2,CFrame.new(.9,.05,0)*CFrame.Angles(0,0,0),CFrame.new(),Vector3.new(1,.4,.4),body3,body3ref,0,Mesh("SpecialMesh",Vector3.new(1,1,1),"Cylinder"))
  300. local t1s = Instance.new("Sound",t1)
  301. t1s.SoundId = "rbxassetid://78498351"
  302. t1s.Volume = 0.5
  303. t1s.Pitch = 1.5
  304.  
  305. Part(t1,CFrame.Angles(.75,0,0)*CFrame.new(.3,.2,0)*CFrame.Angles(0,0,math.pi/2),CFrame.new(),Vector3.new(.025,.15,.15),BrickColor.new(1003),0,0,Mesh("SpecialMesh",Vector3.new(1,1,1),"Cylinder"))
  306. Part(t1,CFrame.Angles(.75,0,0)*CFrame.new(0,.2,0)*CFrame.Angles(0,0,math.pi/2),CFrame.new(),Vector3.new(.025,.15,.15),BrickColor.new(1003),0,0,Mesh("SpecialMesh",Vector3.new(1,1,1),"Cylinder"))
  307. Part(t1,CFrame.Angles(.75,0,0)*CFrame.new(-.3,.2,0)*CFrame.Angles(0,0,math.pi/2),CFrame.new(),Vector3.new(.025,.15,.15),BrickColor.new(1003),0,0,Mesh("SpecialMesh",Vector3.new(1,1,1),"Cylinder"))
  308. Part(t1,CFrame.Angles(-.75,0,0)*CFrame.new(.3,.2,0)*CFrame.Angles(0,0,math.pi/2),CFrame.new(),Vector3.new(.025,.15,.15),BrickColor.new(1003),0,0,Mesh("SpecialMesh",Vector3.new(1,1,1),"Cylinder"))
  309. Part(t1,CFrame.Angles(-.75,0,0)*CFrame.new(0,.2,0)*CFrame.Angles(0,0,math.pi/2),CFrame.new(),Vector3.new(.025,.15,.15),BrickColor.new(1003),0,0,Mesh("SpecialMesh",Vector3.new(1,1,1),"Cylinder"))
  310. Part(t1,CFrame.Angles(-.75,0,0)*CFrame.new(-.3,.2,0)*CFrame.Angles(0,0,math.pi/2),CFrame.new(),Vector3.new(.025,.15,.15),BrickColor.new(1003),0,0,Mesh("SpecialMesh",Vector3.new(1,1,1),"Cylinder"))
  311. Part(t1,CFrame.new(.5,0,0),CFrame.new(),Vector3.new(.01,.225,.225),BrickColor.new(1003),0,0,Mesh("SpecialMesh",Vector3.new(1,1,1),"Cylinder"))
  312.  
  313. local b = Part(main,CFrame.new(0,-.65,-2.9),CFrame.new(),Vector3.new(2.8,2,7.9),body,bodyref,0)
  314. local b2 = Part(b,CFrame.new(0,-.5,-2.5),CFrame.new(),Vector3.new(7,1,2),body,bodyref,0)
  315.  
  316. local w = Part(b2,CFrame.new(-3.5,0,0),CFrame.new(),Vector3.new(1.2,1.05,2),body,bodyref,0)
  317. local w = Part(w,CFrame.new(.6,0,-1)*CFrame.Angles(0,.5,0)*CFrame.new(-.6,0,-1),CFrame.new(),Vector3.new(1.2,1.049,2),body,bodyref,0)
  318. Part(w,CFrame.new(.6,0,0),CFrame.new(),Vector3.new(.5,1.1,2.07),body2,body2ref,0)
  319. local w = Part(w,CFrame.new(.6,0,-1)*CFrame.Angles(0,.5,0)*CFrame.new(-.6,0,-.95),CFrame.new(),Vector3.new(1.2,1.05,1.9),body,bodyref,0)
  320. Part(w,CFrame.new(.6,0,0),CFrame.new(),Vector3.new(.5,1.095,2.05),body2,body2ref,0)
  321. local w = Part(w,CFrame.new(.6,0,-.95)*CFrame.Angles(0,.57,0)*CFrame.new(-.65,0,-1.2),CFrame.new(),Vector3.new(1.3,1.049,2.4),body,bodyref,0)
  322. Part(w,CFrame.new(.65,0,.8),CFrame.new(),Vector3.new(.5,1.1,.95),body2,body2ref,0)
  323. local w = Part(w,CFrame.new(-.6,0,-1.2)*CFrame.Angles(0,-1.57,0)*CFrame.new(.8,0,-1.25),CFrame.new(),Vector3.new(1.6,1.05,2.5),body,bodyref,0)
  324. local w = Part(w,CFrame.new(-.8,0,-1.25)*CFrame.Angles(0,-.4,0)*CFrame.new(.7,0,1.25),CFrame.new(),Vector3.new(1.4,1.049,2.5),body,bodyref,0)
  325. local w = Part(w,CFrame.new(.7,0,1.25)*CFrame.Angles(0,-.45,0)*CFrame.new(-.7,0,1),CFrame.new(),Vector3.new(1.4,1.05,2),body,bodyref,0)
  326. local w = Part(w,CFrame.new(-.7,0,1)*CFrame.Angles(0,.6,0)*CFrame.new(.7,0,1),CFrame.new(),Vector3.new(1.4,1.049,2),body,bodyref,0)
  327. local w = Part(w,CFrame.new(-.7,0,1)*CFrame.Angles(0,.55,0)*CFrame.new(.7,0,1),CFrame.new(),Vector3.new(1.4,1.05,2),body,bodyref,0)
  328. local w = Part(w,CFrame.new(-.7,0,1)*CFrame.Angles(0,.5,0)*CFrame.new(.7,0,1),CFrame.new(),Vector3.new(1.4,1.049,2),body,bodyref,0)
  329. local w = Part(w,CFrame.new(-.7,0,1)*CFrame.Angles(0,.45,0)*CFrame.new(.6,0,.5),CFrame.new(),Vector3.new(1.5,1.05,1),body,bodyref,0)
  330. local w = Part(w,CFrame.new(-.75,0,.5)*CFrame.Angles(0,.325,0)*CFrame.new(.5,0,1.3),CFrame.new(),Vector3.new(1.6,1.049,2.6),body,bodyref,0)
  331. local w = Part(w,CFrame.new(-.2,0,1.3)*CFrame.Angles(0,.65,0)*CFrame.new(.5,0,.8),CFrame.new(),Vector3.new(1,1.05,1.6),body,bodyref,0)
  332. local w = Part(w,CFrame.new(-.5,0,.8)*CFrame.Angles(0,.45,0)*CFrame.new(.5,0,1),CFrame.new(),Vector3.new(1,1.05,2),body,bodyref,0)
  333.  
  334.  
  335. cancollide = false
  336. Part(b2,CFrame.new(-3.5-3,.125,0)*CFrame.Angles(-math.pi/2,0,0),CFrame.new(),Vector3.new(3,3,1),body2,body2ref,0,Mesh("SpecialMesh",Vector3.new(5,5,6),"FileMesh","rbxassetid://3270017"),"DiamondPlate")
  337. Part(b2,CFrame.new(-3.5-3,-.125,0)*CFrame.Angles(-math.pi/2,0,0),CFrame.new(),Vector3.new(3,3,1),body2,body2ref,0,Mesh("SpecialMesh",Vector3.new(5,5,6),"FileMesh","rbxassetid://3270017"))
  338. cancollide = true
  339.  
  340. local propl,proplw = Part(b2,CFrame.new(-6.5,0,0),CFrame.new(),Vector3.new(.4,.75,.4),body2,body2ref,0,Mesh("CylinderMesh",Vector3.new(1,1,1)),"DiamondPlate")
  341. Part(propl,CFrame.new(0,.35,0),CFrame.new(),Vector3.new(.6,.25,.6),body3,body3ref,0,Mesh("CylinderMesh",Vector3.new(1,1,1)),"DiamondPlate")
  342. Part(propl,CFrame.new(0,-.35,0),CFrame.new(),Vector3.new(.5,.15,.5),body3,body3ref,0,Mesh("CylinderMesh",Vector3.new(1,1,1)),"DiamondPlate")
  343. Part(propl,CFrame.Angles(0,0*math.pi*2/3,0)*CFrame.new(0,0,.3),CFrame.new(),Vector3.new(.15,.65,.3),body3,body3ref,0,nil,"DiamondPlate")
  344. Part(propl,CFrame.Angles(0,1*math.pi*2/3,0)*CFrame.new(0,0,.3),CFrame.new(),Vector3.new(.15,.65,.3),body3,body3ref,0,nil,"DiamondPlate")
  345. Part(propl,CFrame.Angles(0,2*math.pi*2/3,0)*CFrame.new(0,0,.3),CFrame.new(),Vector3.new(.15,.65,.3),body3,body3ref,0,nil,"DiamondPlate")
  346. propl.Name = "SoundPlayer1"
  347. local ps2 = Instance.new("Sound",propl)
  348. ps2.SoundId = "rbxassetid://134145308"
  349. ps2.Pitch = 2
  350. ps2.Volume = 1
  351. ps2.Looped = true
  352. ps2:Play()
  353.  
  354.  
  355. local p = Part(propl,CFrame.Angles(0,0*math.pi*2/3,0)*CFrame.new(0,0,.35+.8)*CFrame.Angles(0,0,-1.3),CFrame.new(),Vector3.new(.05,.5,1.7),body2,body2ref,0,nil,"Plastic")
  356. Part(p,CFrame.Angles(0,0,1.3)*CFrame.new(-.125,0,.85),CFrame.new(),Vector3.new(.7,.25,.05),body2,body2ref,0,nil,"Plastic")
  357. local p = Part(propl,CFrame.Angles(0,1*math.pi*2/3,0)*CFrame.new(0,0,.35+.8)*CFrame.Angles(0,0,-1.3),CFrame.new(),Vector3.new(.05,.5,1.7),body2,body2ref,0,nil,"Plastic")
  358. Part(p,CFrame.Angles(0,0,1.3)*CFrame.new(-.125,0,.85),CFrame.new(),Vector3.new(.7,.25,.05),body2,body2ref,0,nil,"Plastic")
  359. local p = Part(propl,CFrame.Angles(0,2*math.pi*2/3,0)*CFrame.new(0,0,.35+.8)*CFrame.Angles(0,0,-1.3),CFrame.new(),Vector3.new(.05,.5,1.7),body2,body2ref,0,nil,"Plastic")
  360. Part(p,CFrame.Angles(0,0,1.3)*CFrame.new(-.125,0,.85),CFrame.new(),Vector3.new(.7,.25,.05),body2,body2ref,0,nil,"Plastic")
  361.  
  362.  
  363. local w = Part(b2,CFrame.new(3.5,0,0),CFrame.new(),Vector3.new(1.2,1.05,2),body,bodyref,0)
  364. local w = Part(w,CFrame.new(-.6,0,-1)*CFrame.Angles(0,-.5,0)*CFrame.new(.6,0,-1),CFrame.new(),Vector3.new(1.2,1.049,2),body,bodyref,0)
  365. Part(w,CFrame.new(-.6,0,0),CFrame.new(),Vector3.new(.5,1.1,2.07),body2,body2ref,0)
  366. local w = Part(w,CFrame.new(-.6,0,-1)*CFrame.Angles(0,-.5,0)*CFrame.new(.6,0,-.95),CFrame.new(),Vector3.new(1.2,1.05,1.9),body,bodyref,0)
  367. Part(w,CFrame.new(-.6,0,0),CFrame.new(),Vector3.new(.5,1.095,2.05),body2,body2ref,0)
  368. local w = Part(w,CFrame.new(-.6,0,-.95)*CFrame.Angles(0,-.57,0)*CFrame.new(.65,0,-1.2),CFrame.new(),Vector3.new(1.3,1.049,2.4),body,bodyref,0)
  369. Part(w,CFrame.new(-.65,0,.8),CFrame.new(),Vector3.new(.5,1.1,.95),body2,body2ref,0)
  370. local w = Part(w,CFrame.new(.6,0,-1.2)*CFrame.Angles(0,1.57,0)*CFrame.new(-.8,0,-1.25),CFrame.new(),Vector3.new(1.6,1.05,2.5),body,bodyref,0)
  371. local w = Part(w,CFrame.new(.8,0,-1.25)*CFrame.Angles(0,.4,0)*CFrame.new(-.7,0,1.25),CFrame.new(),Vector3.new(1.4,1.049,2.5),body,bodyref,0)
  372. local w = Part(w,CFrame.new(-.7,0,1.25)*CFrame.Angles(0,.45,0)*CFrame.new(.7,0,1),CFrame.new(),Vector3.new(1.4,1.05,2),body,bodyref,0)
  373. local w = Part(w,CFrame.new(.7,0,1)*CFrame.Angles(0,-.6,0)*CFrame.new(-.7,0,1),CFrame.new(),Vector3.new(1.4,1.049,2),body,bodyref,0)
  374. local w = Part(w,CFrame.new(.7,0,1)*CFrame.Angles(0,-.55,0)*CFrame.new(-.7,0,1),CFrame.new(),Vector3.new(1.4,1.05,2),body,bodyref,0)
  375. local w = Part(w,CFrame.new(.7,0,1)*CFrame.Angles(0,-.5,0)*CFrame.new(-.7,0,1),CFrame.new(),Vector3.new(1.4,1.049,2),body,bodyref,0)
  376. local w = Part(w,CFrame.new(.7,0,1)*CFrame.Angles(0,-.45,0)*CFrame.new(-.6,0,.5),CFrame.new(),Vector3.new(1.5,1.05,1),body,bodyref,0)
  377. local w = Part(w,CFrame.new(.75,0,.5)*CFrame.Angles(0,-.325,0)*CFrame.new(-.5,0,1.3),CFrame.new(),Vector3.new(1.6,1.049,2.6),body,bodyref,0)
  378. local w = Part(w,CFrame.new(.2,0,1.3)*CFrame.Angles(0,-.65,0)*CFrame.new(-.5,0,.8),CFrame.new(),Vector3.new(1,1.05,1.6),body,bodyref,0)
  379. local w = Part(w,CFrame.new(.5,0,.8)*CFrame.Angles(0,-.45,0)*CFrame.new(-.5,0,1),CFrame.new(),Vector3.new(1,1.05,2),body,bodyref,0)
  380.  
  381.  
  382. cancollide = false
  383. Part(b2,CFrame.new(3.5+3,.125,0)*CFrame.Angles(-math.pi/2,0,0),CFrame.new(),Vector3.new(3,3,1),body2,body2ref,0,Mesh("SpecialMesh",Vector3.new(5,5,6),"FileMesh","rbxassetid://3270017"),"DiamondPlate")
  384. Part(b2,CFrame.new(3.5+3,-.125,0)*CFrame.Angles(-math.pi/2,0,0),CFrame.new(),Vector3.new(3,3,1),body2,body2ref,0,Mesh("SpecialMesh",Vector3.new(5,5,6),"FileMesh","rbxassetid://3270017"))
  385. cancollide = true
  386.  
  387. local propr,proprw = Part(b2,CFrame.new(6.5,0,0),CFrame.new(),Vector3.new(.4,.75,.4),body2,body2ref,0,Mesh("CylinderMesh",Vector3.new(1,1,1)),"DiamondPlate")
  388. Part(propr,CFrame.new(0,.35,0),CFrame.new(),Vector3.new(.6,.25,.6),body3,body3ref,0,Mesh("CylinderMesh",Vector3.new(1,1,1)),"DiamondPlate")
  389. Part(propr,CFrame.new(0,-.35,0),CFrame.new(),Vector3.new(.5,.15,.5),body3,body3ref,0,Mesh("CylinderMesh",Vector3.new(1,1,1)),"DiamondPlate")
  390. Part(propr,CFrame.Angles(0,0*math.pi*2/3,0)*CFrame.new(0,0,.3),CFrame.new(),Vector3.new(.15,.65,.3),body3,body3ref,0,nil,"DiamondPlate")
  391. Part(propr,CFrame.Angles(0,1*math.pi*2/3,0)*CFrame.new(0,0,.3),CFrame.new(),Vector3.new(.15,.65,.3),body3,body3ref,0,nil,"DiamondPlate")
  392. Part(propr,CFrame.Angles(0,2*math.pi*2/3,0)*CFrame.new(0,0,.3),CFrame.new(),Vector3.new(.15,.65,.3),body3,body3ref,0,nil,"DiamondPlate")
  393. propr.Name = "SoundPlayer2"
  394. local ps = Instance.new("Sound",propr)
  395. ps.SoundId = "rbxassetid://134145308"
  396. ps.Pitch = 2
  397. ps.Volume = 1
  398. ps.Looped = true
  399. ps:Play()
  400.  
  401. local p = Part(propr,CFrame.Angles(0,0*math.pi*2/3,0)*CFrame.new(0,0,.35+.8)*CFrame.Angles(0,0,1.3),CFrame.new(),Vector3.new(.05,.5,1.7),body2,body2ref,0,nil,"Plastic")
  402. Part(p,CFrame.Angles(0,0,-1.3)*CFrame.new(.125,0,.85),CFrame.new(),Vector3.new(.7,.25,.05),body2,body2ref,0,nil,"Plastic")
  403. local p = Part(propr,CFrame.Angles(0,1*math.pi*2/3,0)*CFrame.new(0,0,.35+.8)*CFrame.Angles(0,0,1.3),CFrame.new(),Vector3.new(.05,.5,1.7),body2,body2ref,0,nil,"Plastic")
  404. Part(p,CFrame.Angles(0,0,-1.3)*CFrame.new(.125,0,.85),CFrame.new(),Vector3.new(.7,.25,.05),body2,body2ref,0,nil,"Plastic")
  405. local p = Part(propr,CFrame.Angles(0,2*math.pi*2/3,0)*CFrame.new(0,0,.35+.8)*CFrame.Angles(0,0,1.3),CFrame.new(),Vector3.new(.05,.5,1.7),body2,body2ref,0,nil,"Plastic")
  406. Part(p,CFrame.Angles(0,0,-1.3)*CFrame.new(.125,0,.85),CFrame.new(),Vector3.new(.7,.25,.05),body2,body2ref,0,nil,"Plastic")
  407.  
  408.  
  409.  
  410. local p1 = Part(main,CFrame.new(-1.85,.35,-1.1)*CFrame.Angles(0,math.pi/2,0),CFrame.new(),Vector3.new(1.25,.7,.7),pipe,piperef,0,Mesh("SpecialMesh",Vector3.new(1,1,1),"Cylinder"))
  411. Part(p1,CFrame.new(.5,0,.025),CFrame.new(),Vector3.new(1.5,1,1),pipe2,pipe2ref,0,Mesh("SpecialMesh",Vector3.new(.7,.85,.85),"Cylinder"),"DiamondPlate")
  412. Part(p1,CFrame.new(-.625,0,0),CFrame.new(),Vector3.new(.7,.7,.7),pipe,piperef,0,Mesh("SpecialMesh",Vector3.new(1,1,1),"Sphere"))
  413. local p1 = Part(p1,CFrame.new(-.625,0,0)*CFrame.Angles(0,0,-1)*CFrame.new(-.95,0,0),CFrame.new(),Vector3.new(1.9,.7,.7),pipe,piperef,0,Mesh("SpecialMesh",Vector3.new(1,1,1),"Cylinder"))
  414. Part(p1,CFrame.new(-.95,0,0),CFrame.new(),Vector3.new(.7,.7,.7),pipe,piperef,0,Mesh("SpecialMesh",Vector3.new(1,1,1),"Sphere"))
  415. local p1 = Part(p1,CFrame.new(-.95,0,0)*CFrame.Angles(0,0,1)*CFrame.new(-1.25,0,0),CFrame.new(),Vector3.new(2.5,.7,.7),pipe,piperef,0,Mesh("SpecialMesh",Vector3.new(1,1,1),"Cylinder"))
  416. local p = Part(p1,CFrame.new(-.3,0,.01),CFrame.new(),Vector3.new(1.5,1,1),pipe2,pipe2ref,0,Mesh("SpecialMesh",Vector3.new(1,.8,.8),"Cylinder"),"DiamondPlate")
  417. Part(p,CFrame.new(.6,0,0),CFrame.new(),Vector3.new(.15,.9,.9),pipe3,pipe3ref,0,Mesh("SpecialMesh",Vector3.new(1,1,1),"Cylinder"))
  418. Part(p,CFrame.new(-.6,0,0),CFrame.new(),Vector3.new(.15,.9,.9),pipe3,pipe3ref,0,Mesh("SpecialMesh",Vector3.new(1,1,1),"Cylinder"))
  419. Part(p,CFrame.new(0,0,.65),CFrame.new(),Vector3.new(1.3,.3,.5),pipe3,pipe3ref,0)
  420. Part(p1,CFrame.new(-1.25,0,0),CFrame.new(),Vector3.new(.15,.65,.65),pipe3,pipe3ref,0,Mesh("SpecialMesh",Vector3.new(1,1,1),"Cylinder"))
  421. local p = Part(p1,CFrame.new(-1.35,0,0)*CFrame.Angles(math.pi/2,0,math.pi/2),CFrame.new(),Vector3.new(1,1,1),pipe3,pipe3ref,0,Mesh("SpecialMesh",Vector3.new(.5,2,.5),"FileMesh","rbxassetid://16659502"))
  422. local firel = Instance.new("Fire",p)
  423. local lightl = Instance.new("PointLight",p)
  424.  
  425. local p1 = Part(main,CFrame.new(1.85,.35,-1.1)*CFrame.Angles(0,math.pi/2,0),CFrame.new(),Vector3.new(1.25,.7,.7),pipe,piperef,0,Mesh("SpecialMesh",Vector3.new(1,1,1),"Cylinder"))
  426. Part(p1,CFrame.new(.5,0,-.025),CFrame.new(),Vector3.new(1.5,1,1),pipe2,pipe2ref,0,Mesh("SpecialMesh",Vector3.new(.7,.85,.85),"Cylinder"),"DiamondPlate")
  427. Part(p1,CFrame.new(-.625,0,0),CFrame.new(),Vector3.new(.7,.7,.7),pipe,piperef,0,Mesh("SpecialMesh",Vector3.new(1,1,1),"Sphere"))
  428. local p1 = Part(p1,CFrame.new(-.625,0,0)*CFrame.Angles(0,0,-1)*CFrame.new(-.95,0,0),CFrame.new(),Vector3.new(1.9,.7,.7),pipe,piperef,0,Mesh("SpecialMesh",Vector3.new(1,1,1),"Cylinder"))
  429. Part(p1,CFrame.new(-.95,0,0),CFrame.new(),Vector3.new(.7,.7,.7),pipe,piperef,0,Mesh("SpecialMesh",Vector3.new(1,1,1),"Sphere"))
  430. local p1 = Part(p1,CFrame.new(-.95,0,0)*CFrame.Angles(0,0,1)*CFrame.new(-1.25,0,0),CFrame.new(),Vector3.new(2.5,.7,.7),pipe,piperef,0,Mesh("SpecialMesh",Vector3.new(1,1,1),"Cylinder"))
  431. local p = Part(p1,CFrame.new(-.3,0,-.01),CFrame.new(),Vector3.new(1.5,1,1),pipe2,pipe2ref,0,Mesh("SpecialMesh",Vector3.new(1,.8,.8),"Cylinder"),"DiamondPlate")
  432. Part(p,CFrame.new(.6,0,0),CFrame.new(),Vector3.new(.15,.9,.9),pipe3,pipe3ref,0,Mesh("SpecialMesh",Vector3.new(1,1,1),"Cylinder"))
  433. Part(p,CFrame.new(-.6,0,0),CFrame.new(),Vector3.new(.15,.9,.9),pipe3,pipe3ref,0,Mesh("SpecialMesh",Vector3.new(1,1,1),"Cylinder"))
  434. Part(p,CFrame.new(0,0,-.65),CFrame.new(),Vector3.new(1.3,.3,.5),pipe3,pipe3ref,0)
  435. Part(p1,CFrame.new(-1.25,0,0),CFrame.new(),Vector3.new(.15,.65,.65),pipe3,pipe3ref,0,Mesh("SpecialMesh",Vector3.new(1,1,1),"Cylinder"))
  436. local p = Part(p1,CFrame.new(-1.35,0,0)*CFrame.Angles(math.pi/2,0,math.pi/2),CFrame.new(),Vector3.new(1,1,1),pipe3,pipe3ref,0,Mesh("SpecialMesh",Vector3.new(.5,2,.5),"FileMesh","rbxassetid://16659502"))
  437. local firer = Instance.new("Fire",p)
  438. local lightr = Instance.new("PointLight",p)
  439.  
  440. cancollide = false
  441. local s = Part(main,CFrame.new(1.05,3,-2.7)*CFrame.Angles(-.5,0,0)*CFrame.new(0,0,.75),CFrame.new(),Vector3.new(.3,.3,1.5),body,bodyref,0)
  442. local s = Part(s,CFrame.new(0,.15,.75)*CFrame.Angles(.55,0,0)*CFrame.new(0,-.15,1.5),CFrame.new(),Vector3.new(.299,.3,3),body,bodyref,0)
  443. local s = Part(s,CFrame.new(0,.15,1.5)*CFrame.Angles(1.05,0,0)*CFrame.new(0,-.15,1),CFrame.new(),Vector3.new(.3,.3,2),body,bodyref,0)
  444. Part(s,CFrame.new(0,0,.75),CFrame.new(),Vector3.new(.4,.4,.4),pipe3,pipe3ref,0)
  445.  
  446. local s = Part(main,CFrame.new(-1.05,3,-2.7)*CFrame.Angles(-.5,0,0)*CFrame.new(0,0,.75),CFrame.new(),Vector3.new(.3,.3,1.5),body,bodyref,0)
  447. local s = Part(s,CFrame.new(0,.15,.75)*CFrame.Angles(.55,0,0)*CFrame.new(0,-.15,1.5),CFrame.new(),Vector3.new(.299,.3,3),body,bodyref,0)
  448. local s = Part(s,CFrame.new(0,.15,1.5)*CFrame.Angles(1.05,0,0)*CFrame.new(0,-.15,1),CFrame.new(),Vector3.new(.3,.3,2),body,bodyref,0)
  449. Part(s,CFrame.new(0,0,.75),CFrame.new(),Vector3.new(.4,.4,.4),pipe3,pipe3ref,0)
  450. cancollide = true
  451.  
  452. local hp = Instance.new("Part",m)
  453. hp.Anchored = true
  454. hp.TopSurface,hp.BottomSurface =0,0
  455. hp.BrickColor = BrickColor.new("Dark red")
  456. hp.FormFactor = "Custom"
  457. hp.CanCollide = false
  458. hp.Size = Vector3.new(8,1.5,.5)
  459.  
  460. local hptop = hp:Clone()
  461. hptop.Parent = m
  462. hptop.BrickColor = BrickColor.new("Dark green")
  463.  
  464. firer.Size = .01
  465. firer.Heat = 1000
  466. firel.Size = .01
  467. firel.Heat = 1000
  468.  
  469. local hm = Instance.new("Sound",sg)
  470. hm.SoundId = "rbxassetid://131864673"
  471. hm.Pitch = .8
  472.  
  473. --[[coroutine.wrap(function()
  474. wait(.2)
  475. while wait(.6) do
  476. ps.Pitch = -ps.Pitch
  477. ps2.Pitch = -ps2.Pitch
  478. end
  479. end)()]]
  480.  
  481. local bvel = Instance.new("BodyVelocity",main)
  482. bvel.maxForce = Vector3.new()
  483. bvel.velocity = Vector3.new()
  484. bvel.P = 5000
  485.  
  486. local bgyro = Instance.new("BodyGyro",main)
  487. bgyro.maxTorque = Vector3.new()
  488. bgyro.cframe = main.CFrame
  489. bgyro.D = 800
  490.  
  491. do
  492. local vecs = {}
  493. for i,v in pairs(Enum.NormalId:GetEnumItems()) do
  494. table.insert(vecs,Vector3.FromNormalId(v))
  495. end
  496. function getSide(h,r)
  497.  
  498. local ob = h.CFrame:pointToObjectSpace(r)
  499. if h:IsA("Part") and h.Shape == Enum.PartType.Ball then
  500. return (r-h.Position).unit
  501. elseif h:IsA("Part") and h.Shape == Enum.PartType.Cylinder then
  502. if isClose(math.abs(ob.y),h.Size.Y/2) then -- top
  503. return h.CFrame:vectorToWorldSpace((ob*Vector3.new(0,1,0)).unit)
  504. else
  505. return h.CFrame:vectorToWorldSpace(CFrame.new(Vector3.new(),ob*Vector3.new(1,0,1)).lookVector)
  506. end
  507. elseif h:IsA("WedgePart") then
  508. vecs = {Vector3.new(0,-1,0),Vector3.new(1,0,0),Vector3.new(-1,0,0),Vector3.new(0,0,1)}
  509. end
  510. for i,v in pairs(vecs) do
  511. if (ob*v/(h.Size/2)*v):isClose(v) then
  512. return h.CFrame:vectorToWorldSpace(v)
  513. end
  514. end
  515. if h:IsA("WedgePart") then
  516. return h.CFrame:vectorToWorldSpace(Vector3.new(0,h.Size.Z,h.Size.Y).unit)
  517. end
  518. end
  519. end
  520.  
  521. local function Raycast(ray,ign)
  522. local ign = ign or {m,char}
  523. local h,p = workspace:FindPartOnRayWithIgnoreList(ray,ign)
  524. if h and not h.CanCollide then
  525. table.insert(ign,h)
  526. return Raycast(ray,ign)
  527. else
  528. return h,p
  529. end
  530. end
  531.  
  532. local cam = workspace.CurrentCamera
  533. local vehicleOn = true
  534. local lastVehicleOn = false
  535. local acc = 0
  536. local maxSpeed = 180
  537. local spd = 0
  538. local jump = false
  539.  
  540. local kd = {}
  541. local function isDown(k)
  542. return kd[k:byte()] and 1 or 0
  543. end
  544. mouse.KeyDown:connect(function(k)
  545. kd[k:byte()] = true
  546. if k == "f" then
  547. vehicleOn = not vehicleOn
  548. elseif k == "r" then
  549. -- hval.Value = 0
  550. end
  551. end)
  552. mouse.KeyUp:connect(function(k)
  553. kd[k:byte()] = false
  554. end)
  555.  
  556. mouse.Button1Down:connect(function()
  557. b1d = true
  558. end)
  559. mouse.Button1Up:connect(function()
  560. b1d = false
  561. end)
  562. mouse.Button2Down:connect(function()
  563. b2d = true
  564. end)
  565. mouse.Button2Up:connect(function()
  566. b2d = false
  567. end)
  568.  
  569.  
  570. hum.Changed:connect(function()
  571. if hum.Jump then
  572. jump = true
  573. hum.Jump = false
  574. hum.Sit = true
  575. end
  576. end)
  577.  
  578. local fire = {}
  579.  
  580. mouse.TargetFilter = m
  581.  
  582. local t,delta = tick(),0
  583. local smokers = {}
  584.  
  585. local guntimer = 0
  586. local scon;
  587. local lastjump = 0
  588. scon = step:connect(function()
  589.  
  590. local now = tick()
  591. delta,t = now-t,now
  592.  
  593. if hval.Value <= 0 then
  594. game:service'Debris':AddItem(m,5)
  595. coroutine.wrap(function()
  596. bvel:Destroy()
  597. local parts = {}
  598. local function a(b)
  599. for i,v in pairs(b:GetChildren()) do
  600. if v:IsA("BasePart") then
  601. table.insert(parts,v)
  602. end
  603. a(v)
  604. end
  605. end
  606. a(m)
  607. bvel:Destroy()
  608. bgyro:Destroy()
  609. local aTouched = false
  610. for i,v in pairs(parts) do
  611. v.Touched:connect(function()
  612. if aTouched then return end
  613. aTouched = true
  614. local exp = Instance.new("Explosion",workspace)
  615. exp.Position = v.Position
  616. exp.BlastRadius = 0
  617. exp.BlastPressure = .5
  618. m:BreakJoints()
  619. char:BreakJoints()
  620. for i,x in pairs(m:GetChildren()) do
  621. if x:IsA("BasePart") and v ~= x then
  622. local diff = (x.Position-v.Position)
  623. x.Velocity = x.Velocity + diff.unit * diff.magnitude/0.25/v:GetMass()
  624. end
  625. end
  626. script.Disabled = true
  627. end)
  628. end
  629. wait(5)
  630. script.Disabled = true
  631. end)()
  632. scon:disconnect()
  633. return
  634. else
  635. hp.Transparency = hval.Value == 100 and math.min(1,hp.Transparency+.05) or math.max(0,hp.Transparency-.05)
  636. hptop.Transparency = hp.Transparency
  637. hp.CFrame = CFrame.new(head.Position+Vector3.new(0,9,0))*CFrame.Angles(0,(tick()/2)%(math.pi*2),0)
  638. hptop.Size = Vector3.new(hval.Value/100*(hp.Size.X+.05),hp.Size.Y+.1,hp.Size.Z+.1)
  639. hptop.CFrame = hp.CFrame * CFrame.new(-hp.Size.X/2-.025+hptop.Size.X/2,0,0)
  640. end
  641.  
  642. if b1d and vehicleOn then
  643. guntimer = guntimer + delta
  644. if guntimer > .1 then
  645. t1s:Play()
  646. t1s.Pitch = 1.5 + (math.random()-.5)*.1
  647. guntimer = guntimer - .1
  648. local b = Instance.new("Part",m)
  649. b.Anchored = true
  650. b.FormFactor = "Custom"
  651. b.TopSurface,b.BottomSurface = 0,0
  652. b.CanCollide = false
  653. b.BrickColor = BrickColor.new("Bright yellow")
  654. b.Size = Vector3.new(.2,.2,.8)
  655. local sm = Instance.new("SpecialMesh",b)
  656. sm.MeshId = "rbxassetid://2697549"
  657. sm.Scale = Vector3.new(.5,.5,.25)
  658. local orig = t1.CFrame*CFrame.new(.5,0,0)*CFrame.Angles(0,-math.pi/2,0)
  659. local vel = (mouse.Hit.p-orig.p).unit*250 + main.Velocity*delta
  660. b.CFrame = orig
  661. coroutine.wrap(function()
  662. local t = tick()
  663. while true do
  664. step:wait()
  665. local n = tick()
  666. local d,t = n-t,n
  667. local ocf = b.CFrame
  668. local h,r = Raycast(Ray.new(ocf.p,vel*d),{char,m})
  669. if h then
  670. b:Destroy()
  671. local hit = false
  672. local hp = h.Parent:FindFirstChild("hp") or h.Parent.Parent:FindFirstChild("hp")
  673. if hp and hp:IsA("NumberValue") then
  674. hp.Value = hp.Value - 3
  675. hit = "rbxassetid://142082170"
  676. end
  677. local hp = h.Parent:FindFirstChild("Humanoid") or h.Parent.Parent:FindFirstChild("Humanoid")
  678. if hp and hp:IsA("Humanoid") then
  679. hp.Health = hp.Health - 3
  680. hit = "rbxassetid://133758570"
  681. end
  682. if hit then
  683. hm:Play()
  684. local sp = Instance.new("Part",m)
  685. sp.FormFactor = "Custom"
  686. sp.Size = Vector3.new()
  687. sp.Transparency = 1
  688. sp.Anchored = true
  689. sp.CanCollide = false
  690. sp.CFrame = CFrame.new(r)
  691. local s = Instance.new("Sound",sp)
  692. s.SoundId = hit
  693. s.Volume = 1
  694. s.Pitch = 1.1+math.random()*.2
  695. wait()
  696. s:Play()
  697. game:service'Debris':AddItem(sp,5)
  698. end
  699. break
  700. end
  701. b.CFrame = CFrame.new(ocf.p+vel*d,ocf.p+vel*d*2)
  702. sm.Scale = Vector3.new(.5-vel.magnitude*d/100,.5-vel.magnitude*d/100,vel.magnitude*d/3)
  703. vel = vel - Vector3.new(0,4*d,0)
  704. if ocf.Y < -100 then
  705. b:Destroy()
  706. break
  707. end
  708. end
  709. end)()
  710. end
  711. else
  712. guntimer = 0
  713. end
  714.  
  715. local mcfr = main.CFrame
  716. local mpos = mcfr.p
  717.  
  718. local raydir = Vector3.new(0,-100,0)--mcfr:vectorToWorldSpace(Vector3.new(0,-100,0))
  719.  
  720. local dhit,dray = Raycast(Ray.new(mpos,raydir),{char,m})
  721. local diff = dray-mpos
  722.  
  723. local rays = {
  724. tip = Ray.new((mcfr*CFrame.new(0,0,-11.5)).p,raydir),
  725. Ray.new((mcfr*CFrame.new(7,0,-11)).p,raydir),
  726. Ray.new((mcfr*CFrame.new(-7,0,-11)).p,raydir),
  727. Ray.new((mcfr*CFrame.new(1,0,-10.5)).p,raydir),
  728. Ray.new((mcfr*CFrame.new(-1,0,-10.5)).p,raydir),
  729. Ray.new((mcfr*CFrame.new(2.5,0,-6)).p,raydir),
  730. Ray.new((mcfr*CFrame.new(-2.5,0,-6)).p,raydir),
  731. rtip = Ray.new((mcfr*CFrame.new(10.5,0,-3)).p,raydir),
  732. ltip = Ray.new((mcfr*CFrame.new(-10.5,0,-3)).p,raydir),
  733. rprop = Ray.new((mcfr*CFrame.new(6.5,0,-3)).p,raydir),
  734. lprop = Ray.new((mcfr*CFrame.new(-6.5,0,-3)).p,raydir),
  735. Ray.new((mcfr*CFrame.new(2.5,0,-3)).p,raydir),
  736. Ray.new((mcfr*CFrame.new(-2.5,0,-3)).p,raydir),
  737. Ray.new((mcfr*CFrame.new(6.5,0,-1)).p,raydir),
  738. Ray.new((mcfr*CFrame.new(-6.5,0,-1)).p,raydir),
  739. Ray.new((mcfr*CFrame.new(2.5,0,4)).p,raydir),
  740. Ray.new((mcfr*CFrame.new(-2.5,0,4)).p,raydir),
  741. Ray.new((mcfr*CFrame.new(2.5,0,2)).p,raydir),
  742. Ray.new((mcfr*CFrame.new(-2.5,0,2)).p,raydir),
  743. }
  744. for i,v in pairs(rays) do
  745. local h,r = Raycast(v,{char,m})
  746. local df = r-v.Origin
  747. if df.Y > diff.Y then
  748. diff = df
  749. end
  750. rays[i] = {r=r,d=df,h=h}
  751. end
  752.  
  753. local moving = false
  754. local movdir = Vector3.new()
  755. local hoverHeight = 7 + math.sin(now)/2
  756. local vel = Vector3.new(0,(hoverHeight+diff.Y)*3,0)
  757. if isDown'w'+isDown's'+isDown'd'+isDown'a' > 0 then
  758. moving = true
  759. movdir = Vector3.new(isDown'd'-isDown'a',0,isDown's'-isDown'w')
  760. if movdir.magnitude < .001 then
  761. moving = false
  762. else
  763. movdir = movdir.unit
  764. end
  765. end
  766. bgyro.maxTorque = Vector3.new(1,1,1)*1e5
  767.  
  768. if vehicleOn then
  769. if not lastVehicleOn or not lastDown then
  770. lastDown = tick()
  771. end
  772. if not lastVehicleOn then
  773. local ray = rays.rprop
  774. for a,ray in pairs({rays.rprop,rays.lprop}) do
  775. if ray.h and -ray.d.Y < 5 then
  776. local x = a==1 and 1 or -1
  777. local am = 0
  778. for i=math.pi/4*x,x*(-math.pi-math.pi/4),x*-math.pi/8 do
  779. local p = Instance.new("Part",m)
  780. p.Anchored = true
  781. p.Transparency = 1
  782. p.CanCollide = false
  783. p.FormFactor = "Custom"
  784. p.Size = Vector3.new()
  785. local smoke = Instance.new("Smoke",p)
  786. smoke.Color = Color3.new(.5,.5,.5)--Color3.new(lerp(.5,ray.h.Color.r,.8),lerp(.5,ray.h.Color.g,.8),lerp(.5,ray.h.Color.b,.8))
  787. smoke.Size = .1
  788. smoke.Opacity = .04
  789. smoke.RiseVelocity = 10
  790. p.CFrame = CFrame.new(ray.r,ray.r+mcfr.lookVector*Vector3.new(1,0,1))*CFrame.Angles(math.pi/2,0,i+.2*x)*CFrame.new(0,2.5,0)
  791. local add = am/13
  792. if add > .5 then
  793. add = 1-add
  794. end
  795. am = am + 1
  796. game.Debris:AddItem(p,.75+add*14)
  797. end
  798. end
  799. end
  800. end
  801. local ovel = main.CFrame:vectorToObjectSpace(main.Velocity)
  802.  
  803. local xrot = math.max(-1,math.min(1,ovel.Z/maxSpeed*2))*.25
  804. local zrot = math.max(-1,math.min(1,-ovel.X/maxSpeed*2))*.25
  805. local xadd,zadd = 0,0
  806. if rays.tip.h and dhit and (-rays.tip.d.Y < hoverHeight+10 or -diff.Y < hoverHeight+10) then
  807. local ydiff = rays.tip.r.Y-dray.Y
  808. --print(ydiff)
  809. xadd = math.max(-.75,math.min(.75,math.asin(ydiff/11.5)))
  810. xrot = xrot*math.cos(xadd) + xadd
  811. --print("x",movdir,xadd)
  812. movdir = CFrame.Angles(xadd,0,0)*movdir
  813. --print("x2",movdir)
  814. end
  815.  
  816. if rays.lprop.h and rays.rprop.h and rays.lprop.h == rays.rprop.h and (-rays.lprop.d.Y < hoverHeight+10 or -rays.rprop.d.Y < hoverHeight+10) then
  817. local xdiff = rays.rprop.r.Y-rays.lprop.r.Y
  818. zadd = math.max(-.75,math.min(.75,math.asin(xdiff/22)))
  819. zrot = zrot*math.cos(zadd) + zadd
  820. --print("z",movdir,zadd)
  821. movdir = CFrame.Angles(0,0,zadd)*movdir
  822. --print("z2",movdir)
  823. end
  824. --[[
  825. if movdir.magnitude > .001 then
  826. local p = Instance.new("Part",m)
  827. p.Anchored = true
  828. p.FormFactor = "Custom"
  829. p.CanCollide = false
  830. p.FrontSurface = "Hinge"
  831. p.Size = Vector3.new(1,1,3)
  832. p.CFrame = CFrame.new(head.Position+Vector3.new(0,5,0),head.Position+Vector3.new(0,5,0)+CFrame.new(cam.CoordinateFrame.p,cam.CoordinateFrame.p+cam.CoordinateFrame.lookVector*Vector3.new(1,0,1)):vectorToWorldSpace(movdir))
  833. game.Debris:AddItem(p,.1)
  834. end
  835. ]]
  836. local windup = math.min(1,(tick()-lastDown))
  837.  
  838. if windup < .25 then
  839. moving = false
  840. elseif windup < 1 then
  841. bgyro.maxTorque = Vector3.new(1,1,1)*50000
  842. end
  843. local ldir = windup >= .25 and cam.CoordinateFrame.lookVector*Vector3.new(1,0,1) or main.CFrame.lookVector*Vector3.new(1,0,1)
  844. bgyro.cframe = CFrame.new(main.CFrame.p,main.CFrame.p+ldir)*CFrame.Angles(xrot,0,zrot)
  845. proplw.C1 = proplw.C1 * CFrame.Angles(0,windup*-(.8+main.Velocity.magnitude/maxSpeed*.75)*(moving and 1.5 or 1)+math.random()*.05,0)
  846. proprw.C1 = proprw.C1 * CFrame.Angles(0,windup*(.8+main.Velocity.magnitude/maxSpeed*.75)*(moving and 1.5 or 1)+math.random()*.05,0)
  847.  
  848. local odir = main.CFrame:vectorToObjectSpace(bgyro.cframe.lookVector)
  849. firer.Enabled = ovel.Z < -1 or odir.X < -.1
  850. firel.Enabled = ovel.Z < -1 or odir.X > .1
  851. bvel.maxForce = Vector3.new(70000,-diff.Y < hoverHeight+1+math.max(0,-main.Velocity.Y*delta*40) and 400000 or 40000,70000)
  852.  
  853. windup = windup + main.Velocity.magnitude/maxSpeed*.35*(moving and 1.5 or 1)
  854. ps.Volume = windup*.07
  855. ps2.Volume = ps.Volume
  856. ps.Pitch = ps.Pitch
  857. ps2.Pitch = ps2.Pitch
  858. else
  859. if lastVehicleOn or not lastUp then
  860. lastUp = tick()
  861. end
  862. firel.Enabled,firer.Enabled = false,false
  863. bvel.maxForce = Vector3.new(40000,-diff.Y > 1 and 1e5 or 0,40000)
  864. vel = Vector3.new(0,-100-((tick()-lastUp)*9.81*10)^2,0)
  865. bgyro.cframe = clerp(bgyro.cframe,CFrame.new(mpos,mpos+mcfr.lookVector*Vector3.new(1,0,1)),.2)
  866.  
  867. local windup = 1-math.min(1,(tick()-lastUp)/5)
  868. vel = Vector3.new(0,(1-windup)*-25,0)
  869. proplw.C1 = proplw.C1 * CFrame.Angles(0,-.8*windup,0)
  870. proprw.C1 = proprw.C1 * CFrame.Angles(0,.8*windup,0)
  871. ps.Volume = windup*.07
  872. ps2.Volume = ps.Volume
  873. ps.Pitch = ps.Pitch
  874. ps2.Pitch = ps2.Pitch
  875.  
  876. moving = false
  877.  
  878. if tick()-lastUp > 2 then
  879. hval.Value = math.min(100,hval.Value + .1)
  880. end
  881. end
  882.  
  883. if moving then
  884. local od = movdir
  885. movdir = CFrame.new(cam.CoordinateFrame.p,cam.CoordinateFrame.p+cam.CoordinateFrame.lookVector*Vector3.new(1,0,1)):vectorToWorldSpace(movdir*Vector3.new(1,.25,1))
  886.  
  887. if movdir.magnitude < 0.001 or tostring(movdir):lower():find("nan") then
  888. moving = false
  889. --print(od)
  890. else
  891. movdir = movdir.unit
  892. acc = acc + delta*70
  893. spd = math.min(maxSpeed,spd + acc)
  894. vel = vel + movdir*spd
  895. end
  896. end
  897. if not moving then
  898. spd = 0
  899. acc = 0
  900. end
  901.  
  902. bvel.velocity = vel
  903. if jump then
  904. if vehicleOn and -diff.Y < hoverHeight + 1 and tick()-lastjump > 2 then
  905. tor.Velocity = tor.Velocity + Vector3.new(0,110,0)
  906. lastjump = tick()
  907. end
  908. jump = false
  909. end
  910. lightr.Range = 5+math.sin(tick()*50)
  911. lightl.Range = 5+math.cos(tick()*50)
  912.  
  913. lightr.Color = firer.Color
  914. lightl.Color = firel.Color
  915.  
  916. lightr.Enabled = firer.Enabled
  917. lightl.Enabled = firel.Enabled
  918. lastVehicleOn = vehicleOn
  919. end)
  920.  
  921. char.AncestryChanged:connect(function()
  922. m:Destroy()
  923. scon:disconnect()
  924. end)
  925.  
  926. end
  927. return _G.mantisReload()
Add Comment
Please, Sign In to add comment