Advertisement
good_scripter

Untitled

May 29th, 2019
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 65.29 KB | None | 0 0
  1. if game:GetService("RunService"):IsClient() then error("Please run as a server script. Use h/ instead of hl/.") end
  2. print("FE Compatibility: by WaverlyCole & Mokiros")
  3. Players = game:service'Players'
  4. Debris = game:service'Debris'
  5.  
  6. CF = CFrame.new
  7. CFa = CFrame.Angles
  8. CFA = function(x,y,z) return CFa(MR(x),MR(y),MR(z)) end
  9. V3 = Vector3.new
  10. MR = math.rad
  11. MD = math.deg
  12. MRND = math.random
  13. CFN=CF(0,0,0)
  14. V3N=V3(0,0,0)
  15. V3M=V3(1/0,1/0,1/0)
  16.  
  17.  
  18. newI = function(tab)
  19. local p = Instance.new(tab[1],tab[2])
  20. for i,v in pairs(tab) do
  21. if i=="Debris" then
  22. Debris:AddItem(p,v)
  23. elseif (i~=1 and i~=2) then
  24. p[i] = v
  25. end
  26. end
  27. return p
  28. end
  29.  
  30. ------------Assets
  31. assets = {}
  32. --Meshes
  33. assets.Ring = "3270017"
  34. assets.Bullet1 = "10207677"
  35. assets.MuzzleFlash = "25212400"
  36. --MeshTexture
  37.  
  38. --Decals
  39.  
  40. --Gui Decals
  41.  
  42. --Sounds
  43. assets.Minigun1 = "2766581"
  44. assets.Fire1 = "2760979"
  45. --
  46. assetprefix = "http://www.roblox.com/asset/?id="
  47. for i,v in pairs(assets) do
  48. if v:sub(1,3)~="htt" and v:sub(1,3)~="rbx" then
  49. assets[i]=assetprefix..v
  50. end
  51. end
  52. ----------------------------
  53. PlaySound=function(soundId,Parent,Pit,Vol)
  54. local v=newI{"Sound",Parent,SoundId=soundId,Volume=Vol,Pitch=Pit,Looped=false,Debris=5}
  55. v:Play()
  56. end
  57.  
  58. newPart = function(sizea,sizeb,sizec,parent,cframe,aa,bb,cc,dd,ee,ff)
  59. local Materials = {}
  60. for i,v in pairs{
  61. "Plastic","SmoothPlastic","Wood", "WoodPlanks",
  62. "Marble", "Slate","Concrete", "Granite",
  63. "Brick","Pebble", "Cobblestone","CorrodedMetal",
  64. "DiamondPlate", "Foil", "Metal","Grass",
  65. "Sand","Fabric","Ice","Neon"} do
  66. Materials[v]=v
  67. end
  68. local mat,col
  69. local part = Instance.new("Part",parent or Model)
  70. for i,v in pairs{aa,bb,cc,dd,ee,ff} do
  71. if Materials[v] then mat=v end
  72. if BrickColor.new(v).Name==v then col=v end
  73. if v=="CylinderMesh" or v=="BlockMesh" then local m = Instance.new(v,part) m.Name="Mesh" end
  74. if v=="Torso" then newI{"SpecialMesh",part,MeshType="Torso"} end
  75. if v=="Sphere" then newI{"SpecialMesh",part,MeshType="Sphere"} end
  76. if v=="Wedge" then part:Destroy() part=Instance.new("WedgePart",parent or Model) end
  77. if v=="Corner" then part:Destroy() part=Instance.new("CornerWedgePart",parent or Model) end
  78. if v=="Ring" then newI{"SpecialMesh",part,MeshType="FileMesh",MeshId=assets.Ring} end
  79. if v=="nonCollide" then part.CanCollide=false end
  80. if v=="Transparent" then part.Transparency=1 end
  81. if v=="Anchored" then part.Anchored=true end
  82. if v=="S0.5" then sizea=sizea/2 sizeb=sizeb/2 sizec=sizec/2 part.Mesh.Scale=part.Mesh.Scale*2 end
  83. end
  84. if part.className~="CornerWedgePart" then part.formFactor="Custom" end
  85. for i,v in pairs{"Top","Bottom","Left","Right","Front","Back"} do
  86. part[v.."Surface"]="SmoothNoOutlines"
  87. end
  88. part.Size=V3(sizea,sizeb,sizec) or V3(1,1,1)
  89. part.CFrame=cframe or CF(0,-50,0)
  90. part.BrickColor=BrickColor.new(col or '')
  91. part.Material = mat or 'SmoothPlastic'
  92. part:BreakJoints()
  93. part.Elasticity = 0
  94. part.Name="z"
  95. part.CustomPhysicalProperties = PhysicalProperties.new(2,2,0,2,0)
  96. return part,cframe
  97. end
  98.  
  99. newMesh=function(parent,dtype,sx,sy,sz)
  100. local filemesh
  101. local mesh
  102. if dtype=="Block" or dtype=="Cylinder" then
  103. mesh=INEW(types.."Mesh",parent)
  104. elseif dtype:sub(1,4)=="http" or dtype:sub(1,3)=="rbx" then
  105. mesh=INEW("SpecialMesh",parent)
  106. mesh.MeshType="FileMesh"
  107. mesh.MeshId=dtype
  108. filemesh=true
  109. else
  110. mesh=INEW("SpecialMesh",parent)
  111. mesh.MeshType=dtype
  112. end
  113. if parent.Size.x<=0.2 then parent.CanCollide=false end
  114. local yes=parent.Size.x<0.2001 and 5 or 1
  115. if filemesh then yes=1 end
  116. mesh.Scale=V3(sx or 1,sy or 1,sz or 1)*yes
  117. return mesh
  118. end
  119.  
  120. newWeld = function(parent,P0,P1,C0,C1)
  121. local weld=Instance.new("Weld",parent or P0)
  122. weld.Part0=P0
  123. weld.Part1=P1
  124. weld.C0=C0 or weld.C0
  125. weld.C1=C1 or weld.C1
  126. return weld
  127. end
  128. newWeld6D = function(parent,P0,P1,C0,C1)
  129. local weld=Instance.new("Motor6D",parent or P0)
  130. weld.Part0=P0
  131. weld.Part1=P1
  132. weld.C0=C0 or weld.C0
  133. weld.C1=C1 or weld.C1
  134. return weld
  135. end
  136.  
  137. ray = function(Origin,Direction,tab,length) -- ray cast
  138. return workspace:FindPartOnRay(Ray.new(Origin,Direction.unit *(length or 999)),tab)
  139. end
  140. addProjectile = function(Origin,Destination,Speed,onHit,extra,noHit)
  141. local current = CF(Origin,Destination.p)
  142. local co = 0
  143. doIn(4,function(i,wkey,step)
  144. co=co+1
  145. if co%2==0 then
  146. local Speed2 = Speed*step
  147. local Hit,Pos = ray(current.p,Destination.p-Origin,mech,Speed2)
  148. if Hit then
  149. current=current*CF(0,0,-(current.p-Pos).magnitude)
  150. doInT[wkey] = nil
  151. onHit(Hit)
  152. else
  153. current=current*CF(0,0,-Speed2)
  154. end
  155. extra(current,i*4)
  156. end
  157. end,function()
  158. if noHit and noHit~=0 then
  159. noHit()
  160. end
  161. end)
  162. end
  163.  
  164. checkCF = function(weld)
  165. local x,y,z = weld.C0:toEulerAnglesXYZ()
  166. print(weld.Name ..".C0 ",weld.C0.x,weld.C0.y,weld.C0.z," ",MD(x),MD(y),MD(z))
  167. local x,y,z = weld.C1:toEulerAnglesXYZ()
  168. print(weld.Name ..".C1 ",weld.C1.x,weld.C1.y,weld.C1.z," ",MD(x),MD(y),MD(z))
  169. end
  170.  
  171. GetX = function(Part,Point)
  172. local x,y,z=Part.CFrame:toObjectSpace(CFrame.new(Part.Position,Point)):toEulerAnglesXYZ()
  173. return math.deg(x)
  174. end
  175. GetY = function(Part,Point)
  176. local x,y,z=Part.CFrame:toObjectSpace(CFrame.new(Part.Position,Point)):toEulerAnglesXYZ()
  177. return math.deg(y)
  178. end
  179.  
  180. getTriangleValues = function(Points)
  181. local G, V = 0
  182. for S = 1, 3 do
  183. local L = (Points[1+(S+1)%3]-Points[1+S%3]).magnitude
  184. G, V = L > G and L or G, L > G and {Points[1+(S-1)%3], Points[1+(S)%3], Points[1+(S+1)%3]} or V
  185. end
  186. local D = V[2]+(V[3]-V[2]).unit*((V[3]-V[2]).unit:Dot(V[1]-V[2]))
  187. local C, B = (D-V[1]).unit, (V[2]-V[3]).unit
  188. local A = B:Cross(C)
  189. S1 = V3(0.2, (V[2]-D).magnitude, (V[1]-D).magnitude)/1 --0.2
  190. S2 = V3(0.2, (V[3]-D).magnitude, (V[1]-D).magnitude)/1 --0.2
  191. C1 = CF(0,0,0,A.X,B.X,C.X,A.Y,B.Y,C.Y,A.Z,B.Z,C.Z)+(V[1]+V[2])/2
  192. C2 = CF(0,0,0,-A.X,-B.X,C.X,-A.Y,-B.Y,C.Y,-A.Z,-B.Z,C.Z)+(V[1]+V[3])/2
  193. return C1, C2, S1, S2
  194. end
  195.  
  196. fillTriangle = function(...)
  197. local C1,C2,S1,S2 = getTriangleValues(...)
  198. local tri1 = newPart(S1.x,S1.y,S1.z,mech,C1,"Wedge")
  199. local tri2 = newPart(S2.x,S2.y,S2.z,mech,C2,"Wedge")
  200. --for i=1,3 do
  201. --newPart(0.4,0.4,0.4,mech,CF((...)[i]),"nonCollide","Really black","Anchored")
  202. --end
  203. return tri1,tri2
  204. end
  205.  
  206.  
  207.  
  208. n = ""
  209.  
  210. ThighAngle = -40
  211. LegAngle = 135
  212. FootAngle = -40
  213. ToeAngle = -LegAngle-ThighAngle-FootAngle
  214.  
  215. ThighAngle = -25
  216. LegAngle = 75
  217. FootAngle = 10
  218. ToeAngle = -LegAngle-ThighAngle-FootAngle
  219.  
  220. --SCROP SCROP SCROP SCROP SCROP SCROP SCROP SCROP SCROP SCROP SCROP
  221. pcall(function() workspace["RM Mech 2"]:Remove() end)
  222. mech = newI{"Model",workspace,Name="RM Mech 2"}
  223.  
  224. Base = newPart(10,10,8,mech,CF(0,50,0),"nonCollide")
  225. Base.Transparency=1
  226. Torso = newPart(4,4,4,mech,Base.CFrame,"nonCollide","Transparent")
  227. BaseW = newWeld6D(Base,Base,Torso,CF(0,0,0)*CFA(0,0,0))
  228. Torso1 = newPart(4,4,4,mech,Base.CFrame,"nonCollide","Transparent") --for X Turn
  229. Torso1W = newWeld6D(Torso,Torso,Torso1,CF(0,0,0)*CFA(0,0,0))
  230. Torso2 = newPart(4,4,4,mech,Base.CFrame,"nonCollide","Transparent") --for Y Turning Torso
  231. Torso2W = newWeld6D(Torso1,Torso1,Torso2,CF(0,0,0)*CFA(0,0,0))
  232.  
  233.  
  234. --[[
  235. Stand = newPart(2,2,2,mech,Base.CFrame,"Transparent") --Stand (motor6d never used)
  236. Stand.Name = "Left Leg"
  237. StandW = newWeld6D(Base,Base,Stand,CF(-4.5,-7-0.172-6,0))
  238. Stand = newPart(2,2,2,mech,Base.CFrame,"Transparent")
  239. Stand.Name = "Right Leg"
  240. StandW = newWeld6D(Base,Base,Stand,CF( 4.5,-7-0.172-6,0)) --]]
  241.  
  242. ------------------
  243. fillTriangle1Mech = function(...)
  244. local t1,t2 = fillTriangle(...)
  245. newWeld(Torso,Torso2,t1,Torso2.CFrame:toObjectSpace(t1.CFrame))
  246. newWeld(Torso,Torso2,t2,Torso2.CFrame:toObjectSpace(t2.CFrame))
  247. return t1,t2
  248. end
  249.  
  250. ------------------
  251. LThigh = newPart(3,3,3,mech,Torso.CFrame,"nonCollide","Transparent")
  252. LThighW = newWeld6D(Torso,Torso,LThigh,CF(-4.5+1.5,0,0),CF( 1.5,0.5,0)*CFA(ThighAngle,0,0))
  253. RThigh = newPart(3,3,3,mech,Torso.CFrame,"nonCollide","Transparent")
  254. RThighW = newWeld6D(Torso,Torso,RThigh,CF( 4.5-1.5,0,0),CF(-1.5,0.5,0)*CFA(ThighAngle,0,0))
  255. for i,v in pairs{[-1]=LThigh,[1]=RThigh} do
  256. newWeld(Torso,v,newPart(2.2,0.4,2.2,mech,nil,"CylinderMesh","nonCollide","Dark stone grey"),CF(1.41*i,0.5,0)*CFA(0,0,90))
  257. newWeld(Torso,v,newPart(1.8,0.41,1.8,mech,nil,"CylinderMesh","nonCollide","Black"),CF(1.41*i,0.5,0)*CFA(0,0,90))
  258. newWeld(Torso,v,newPart(1.75,0.2,1.75,mech,nil,"CylinderMesh","nonCollide","Really black"),CF(1.41*-i,0.5,0)*CFA(0,0,90))
  259.  
  260. newWeld(Torso,v,newPart(1.4,3.2,1.4,mech,nil,"CylinderMesh","nonCollide","Dark stone grey"),CF(0,-5,0)*CFA(0,0,90))
  261. newWeld(Torso,v,newPart(1.1,3.3,1.1,mech,nil,"CylinderMesh","nonCollide","Black"),CF(0,-5,0)*CFA(0,0,90))
  262. newWeld(Torso,v,newPart(1.6,0.2,1.2,mech,nil),CF(0,-3.9,-0.1))
  263.  
  264. local newp = newPart(1.6,math.sqrt(1+5.5*5.5)+0.05,0.2,mech,nil)
  265. local newpw = newWeld(Torso,v,newp,CF(0,-1.25,1.4-0.52)*CFA(math.deg(math.tan(1/5.5)),0,0))
  266. if i==-1 then
  267. LThighPad = newp
  268. LThighPadW = newpw
  269. else
  270. RThighPad = newp
  271. RThighPadW = newpw
  272. end
  273. local newp = newPart(1.6,math.sqrt(0.2^2+5.5^2)+0.05,0.2,mech,nil)
  274. local newpw = newWeld(Torso,v,newp,CF(0,-1.25,-1.4+0.3)*CFA(-math.deg(math.tan(0.6/5.5)),0,0)*CF(0,2.7725,0),CF(0,2.7725,0)*CFA(0,0,0))
  275. if i==-1 then
  276. LThighPad2 = newp
  277. LThighPad2W = newpw
  278. else
  279. RThighPad2 = newp
  280. RThighPad2W = newpw
  281. end
  282.  
  283. newWeld(Torso,v,newPart(3,1.2,0.8,mech,nil,"Wedge"),CF(0,2.1,-1.5+0.4)*CFA(0,0,0))
  284. newWeld(Torso,v,newPart(3,1.2,0.6,mech,nil),CF(0,2.1,-1.5+1.1))
  285. newWeld(Torso,v,newPart(3,1.2,1.6,mech,nil,"Wedge"),CF(0,2.1, 1.5-0.8)*CFA(0,180,0))
  286. for i=-1,1,2 do
  287. newWeld(Torso,v,newPart(0.7,7.5,1.6,mech,nil),CF(-1.15*i,-2.25,0))
  288. newWeld(Torso,v,newPart(0.7,0.8,0.5,mech,nil,"Wedge"),CF(1.15*i,-6.25,-0.4)*CFA(-90,0,0))
  289. newWeld(Torso,v,newPart(0.7,0.8,0.5,mech,nil,"Wedge"),CF(1.15*i,-6.25, 0.4)*CFA(-90,0,180))
  290. newWeld(Torso,v,newPart(0.7,0.7,7.5,mech,nil,"Wedge"),CF(1.15*i,-2.25,-0.8-0.35)*CFA(-90,0,0))
  291. newWeld(Torso,v,newPart(0.7,0.7,7.5,mech,nil,"Wedge"),CF(1.15*i,-2.25, 0.8+0.35)*CFA(-90,0,180))
  292. end
  293. end
  294. LLeg = newPart(2,2,2,mech,Torso.CFrame,"Transparent","nonCollide")
  295. LLegW = newWeld6D(LThigh,LThigh,LLeg,CF(0,-5,0),CF(0,0,0)*CFA(LegAngle,0,0))
  296. RLeg = newPart(2,2,2,mech,Torso.CFrame,"Transparent","nonCollide")
  297. RLegW = newWeld6D(RThigh,RThigh,RLeg,CF(0,-5,0),CF(0,0,0)*CFA(LegAngle,0,0))
  298. for i,v in pairs{LLeg,RLeg} do
  299. newWeld(Torso,v,newPart(2,1.6,2,mech,nil,"CylinderMesh"),CF(0,0,0)*CFA(0,0,90))
  300. newWeld(Torso,v,newPart(1,1,1,mech,nil,"CylinderMesh"),CF(0,-6,0)*CFA(0,0,90))
  301. newWeld(Torso,v,newPart(1.599,2,1,mech,nil),CFA(4,0,0)*CF(0,-1,-0.49))
  302. newWeld(Torso,v,newPart(1.599,2,1,mech,nil,"Wedge"),CFA(4,0,0)*CF(0,-1,0.5)*CFA(180,0,0))
  303. newWeld(Torso,v,newPart(1.6,3.2,1,mech,nil,"Torso"),CFA(4,0,0)*CF(0,-2-0.8,-0.355)*CFA(165+5,0,0)*CF(0,0.7,0))
  304. newWeld(Torso,v,newPart(1,1.15,1,mech,nil),CF(0,-6,0)*CFA(-17,0,0)*CF(0,0.575,0))
  305. for i=-1,1,2 do
  306. local baa = newPart(0.5,0.4,0.5,mech,nil,"CylinderMesh","Dark stone grey")
  307. newWeld(Torso,v,baa,CF(-0.25*i,-5.5,0.5)*CFA(-5,0,2.2*i))
  308. newWeld(Torso,baa,newPart(0.4,5,0.4,mech,nil,"CylinderMesh","Black"),CF(0,2.5,0))
  309. newWeld(Torso,baa,newPart(0.5,0.5,0.5,mech,nil,"Sphere","Dark stone grey"),CF(0,-0.15,0))
  310. newWeld(Torso,baa,newPart(0.7,1.8,0.7,mech,nil,"CylinderMesh","Dark stone grey"),CF(0,4.1-0.4,0))
  311. end
  312. end
  313. LFoot = newPart(2,2,2,mech,nil,"Transparent","nonCollide")
  314. LFootW = newWeld6D(LLeg,LLeg,LFoot,CF(0,-6,0),CF(0,0,0)*CFA(FootAngle,0,0))
  315. RFoot = newPart(2,2,2,mech,nil,"Transparent","nonCollide")
  316. RFootW = newWeld6D(RLeg,RLeg,RFoot,CF(0,-6,0),CF(0,0,0)*CFA(FootAngle,0,0))
  317. for i,v in pairs{LFoot,RFoot} do
  318. newWeld(Torso,v,newPart(0.8,2.8,0.8,mech,nil,"CylinderMesh","nonCollide","S0.5","Dark stone grey"),CF(0,-1,-5)*CFA(0,0,90))
  319. newWeld(Torso,v,newPart(0.6,2.81,0.6,mech,nil,"CylinderMesh","nonCollide","S0.5","Black"),CF(0,-1,-5)*CFA(0,0,90))
  320. newWeld(Torso,v,newPart(1,0.5,1,mech,nil,"CylinderMesh","nonCollide","S0.5"),CF(0,-1,-5)*CFA(0,-1,90))
  321. newWeld(Torso,v,newPart(1,0.25,1,mech,nil,"CylinderMesh","nonCollide","S0.5"),CF(-0.125-0.65-0.4,-1,-5)*CFA(0,0,90))
  322. newWeld(Torso,v,newPart(1,0.25,1,mech,nil,"CylinderMesh","nonCollide","S0.5"),CF(0.125+0.65+0.4,-1,-5)*CFA(0,0,90))
  323. newWeld(Torso,v,newPart(0.501,1,1,mech,nil,"nonCollide"),CF(0,-1,-4.5))
  324. newWeld(Torso,v,newPart(0.251,1,1,mech,nil,"nonCollide"),CF(-0.125-0.65-0.4,-1,-4.5))
  325. newWeld(Torso,v,newPart(0.251,1,1,mech,nil,"nonCollide"),CF( 0.125+0.65+0.4,-1,-4.5))
  326. newWeld(Torso,v,newPart(1,0.5,5.5,mech,nil,"Wedge"),CF(-0.9-0.15,-1,-1.25)*CFA(0,180,-90))
  327. newWeld(Torso,v,newPart(1,0.5,5.5,mech,nil,"Wedge"),CF( 0.9+0.15,-1,-1.25)*CFA(0,180, 90))
  328. newWeld(Torso,v,newPart(1.6,1,5.5,mech,nil),CF(0,-1,-1.25)) --asd
  329. newWeld(Torso,v,newPart(0.8,1.7,0.8,mech,nil,"CylinderMesh","nonCollide","Dark stone grey"),CF(0,0,0)*CFA(0,0,90))
  330. newWeld(Torso,v,newPart(0.6,1.71,0.6,mech,nil,"CylinderMesh","nonCollide","Black"),CF(0,0,0)*CFA(0,0,90))
  331. for i=-1,1,2 do
  332. newWeld(Torso,v,newPart(0.6,1,1,mech,nil,"Wedge"),CF(0.5*i,-1,2)*CFA(0,180,180)) --heel
  333. newWeld(Torso,v,newPart(0.3,0.5,0.8,mech,nil),CF(0.65*i, 0.25,0)*CFA(0,0,0))
  334. newWeld(Torso,v,newPart(0.3,0.5,1.6,mech,nil),CF(0.65*i,-0.25,0)*CFA(0,0,0))
  335. newWeld(Torso,v,newPart(0.3,0.5,0.4,mech,nil,"Wedge"),CF(0.65*i,0.25,-0.6)*CFA(0, 0,0))
  336. newWeld(Torso,v,newPart(0.3,0.5,0.4,mech,nil,"Wedge"),CF(0.65*i,0.25, 0.6)*CFA(0,180,0))
  337. newWeld(Torso,v,newPart(0.3,0.5,0.2,mech,nil,"Wedge"),CF(0.65*i,-0.25,-0.9)*CFA(0, 0,0))
  338. newWeld(Torso,v,newPart(0.3,0.5,0.2,mech,nil,"Wedge"),CF(0.65*i,-0.25, 0.9)*CFA(0,180,0))
  339. end
  340. end
  341. LToe = newPart(3,1,1,mech,nil,"Dark stone grey","Transparent")
  342. LToeW = newWeld6D(LFoot,LFoot,LToe,CF(0,-1,-5),CF(0,0,0)*CFA(ToeAngle,0,0))
  343. RToe = newPart(3,1,1,mech,nil,"Dark stone grey","Transparent")
  344. RToeW = newWeld6D(RFoot,RFoot,RToe,CF(0,-1,-5),CF(0,0,0)*CFA(ToeAngle,0,0))
  345. for i,v in pairs{LToe,RToe} do
  346. local part = newPart(0.8,1,3,mech,nil,"Wedge","Dark stone grey")
  347. newWeld(Torso,v,part,CF(-0.65,0,-1.75))
  348. local part = newPart(0.8,1,3,mech,nil,"Wedge","Dark stone grey")
  349. newWeld(Torso,v,part,CF(0.65,0,-1.75))
  350. local part = newPart(0.8,1,1,mech,nil,"Wedge","Dark stone grey")
  351. newWeld(Torso,v,part,CF(-0.65,0,0.25)*CFA(180,0,0))
  352. local part = newPart(0.8,1,1,mech,nil,"Wedge","Dark stone grey")
  353. newWeld(Torso,v,part,CF( 0.65,0,0.25)*CFA(180,0,0))
  354. newWeld(Torso,v,newPart(4,3,5,mech,nil,"Transparent"),CF(0,1,-1.5))
  355. end
  356.  
  357.  
  358. ---------------TORSO1 LOWER (NOT Y TURN)
  359. newWeld(Torso,Torso1,newPart(5,3,3,mech,nil,"Torso"),CF(0,-0.5,0)*CFA(180,90,0)) --lowest torso
  360. newWeld(Torso,Torso1,newPart(1.6,3.4,1.6,mech,nil,"CylinderMesh","nonCollide","Dark stone grey"),CF(0,-0.8,-0.55)*CFA(0,0,90))
  361. for i=-1,1,2 do
  362. newWeld(Torso,Torso1,newPart(1.5,1.5,1.5,mech,nil,"Sphere","nonCollide"),CF(3*i,0,0))
  363. newWeld(Torso,Torso1,newPart(1.2,2.4,1.2,mech,nil,"CylinderMesh","nonCollide"),CF(3*i,0,0)*CFA(-55,55*i,0)*CF(0,0,-1.2)*CFA(90,0,0))
  364. end
  365. --Tail
  366. newWeld(Torso,Torso1,newPart(2.5,1.5,2.5,mech,nil,"CylinderMesh"),CF(0,-0.5,2)*CFA(90,0,0)*CF(0,0.5-0.25,0))
  367. newWeld(Torso,Torso1,newPart(2.3,0.2,2.3,mech,nil,"CylinderMesh","Dark stone grey"),CF(0,-0.5,2)*CFA(90,0,0)*CF(0,1-0.09,0))
  368. newWeld(Torso,Torso1,newPart(2,0.5,0.2,mech,nil,"Black"),CF(0,-0.5,2+1-0.08)*CFA(0,0,0))
  369.  
  370.  
  371.  
  372.  
  373. CockpitGlass = {}
  374. ---------------------TORSO2 UPPER
  375. newWeld(Torso,Torso2,newPart(2.9,0.2,2.9,mech,nil,"CylinderMesh","nonCollide","Really black"),CF(0,1-0.09,0))
  376. newWeld(Torso,Torso2,newPart(2.9,0.2,2.9,mech,nil,"CylinderMesh","nonCollide","Really black"),CF(0,1+2+0.09,0))
  377. newWeld(Torso,Torso2,newPart(2.6,2,2.6,mech,nil,"CylinderMesh","Dark stone grey"),CF(0,1+1,0))
  378.  
  379. for i=0.2,1.8,0.4 do
  380. newWeld(Torso,Torso2,newPart(3.1+i/3,0.2,3.1+i/3,mech,nil,"CylinderMesh","nonCollide"),CF(0,1+i,0))
  381. end
  382. newWeld(Torso,Torso2,newPart(8,5,4,mech,nil,"Torso"),CF(0,1+2+2.5,0)*CFA(180,90,0)) -- upper
  383.  
  384. Ceiling = newPart(4,0.2,6,mech,nil)
  385. newWeld(Torso,Torso2,Ceiling,CF(0,16.9,0))
  386.  
  387. newWeld(Torso,Torso2,newPart(4,1,1,mech,nil),CF(0,8-0.5,-4.5)) --floor front
  388. --front glass part
  389. newWeld(Torso,Torso2,newPart(4.4,1,0.2,mech,nil),CF(0,8,-4.9)*CFA(-30,0,0)*CF(0,0.5,0))
  390. newWeld(Torso,Torso2,newPart(0.25,4.4,0.25,mech,nil,"CylinderMesh"),CF(0,8,-4.9)*CFA(-30,0,0)*CF(0,1,0)*CFA(0,0,90)) --glass metal
  391. CockpitGlass[#CockpitGlass+1] = newWeld(Torso,Torso2,newPart(4.4,2+0.1,0.2,mech,nil),CF(0,8,-4.9)*CFA(-30,0,0)*CF(0,1+1,0)).Part1
  392. newWeld(Torso,Torso2,newPart(0.25,4.4,0.25,mech,nil,"CylinderMesh"),CF(0,8,-4.9)*CFA(-30,0,0)*CF(0,1+2,0)*CFA(0,0,90)) --glass metal
  393. CockpitGlass[#CockpitGlass+1] = newWeld(Torso,Torso2,newPart(4.4,1+3.35,0.2,mech,nil),CF(0,8,-4.9)*CFA(-30,0,0)*CF(0,1+2,0)*CFA(30+19.8,0,0)*CF(0,0.5+1.675,0)).Part1
  394. newWeld(Torso,Torso2,newPart(4.4,3,0.2,mech,nil),CF(0,17,-3)*CFA(-135-5,0,0)*CF(0,1.5,0)) --upper ceiling
  395. newWeld(Torso,Torso2,newPart(0.25,4.4,0.25,mech,nil,"CylinderMesh"),CF(0,8,-4.9)*CFA(-30,0,0)*CF(0,1+2,0)*CFA(30+19.8,0,0)*CF(0,1+3.35,0)*CFA(0,0,90)) --glass metal
  396.  
  397.  
  398. for i=-1,1,2 do
  399. newWeld(Torso,Torso2,newPart(6.2,3,2,mech,nil,"Torso"),CF(3*i,1+2+3.5,0)*CFA(180,90,0)) --side torsos
  400. newWeld(Torso,Torso2,newPart(3,1,3,mech,nil,"CylinderMesh"),CF(2.5*i,5,0)*CFA(0,0,90)) -- hipgun
  401.  
  402. newWeld(Torso,Torso2,newPart(1,2,2,mech,nil,"Wedge"),CF(3*i,8-0.5,-4)*CFA(0,-90*i,90*i)) --floorwedge
  403. newWeld(Torso,Torso2,newPart(1,1,2,mech,nil,"Wedge"),CF(3*i,8-0.5, 3.5)*CFA(0,-90*i,90*-i))
  404.  
  405. newWeld(Torso,Torso2,newPart(0.2, 6,6.2,mech,nil),CF(4*i,8,-0.1)*CFA(0,0,-10*i)*CF(-0.1*i,3,0)) --sidewalls
  406. newWeld(Torso,Torso2,newPart(0.2,4.3,6.2,mech,nil),CF(4*i,8,-0.1)*CFA(0,0,-10*i)*CF(0,6,0)*CFA(0,0,55*i)*CF(0,2.15,0)) --sidewall upper
  407. newWeld(Torso,Torso2,newPart(0.2,1,math.sqrt(2*2+2*2)+0.1,mech,nil),CF(-2.9*i,8,-4)*CFA(0,-45*i,25*i)*CF(0,0.5,0.05)) --side front
  408.  
  409. --metal glasses
  410. newWeld(Torso,Torso2,newPart(0.25,4,0.25,mech,nil,"CylinderMesh"),CF(2.2*i,8,-4.9)*CFA(-30,0,0)*CF(0,1+1-1,0))
  411. newWeld(Torso,Torso2,newPart(0.25,4.4,0.25,mech,nil,"CylinderMesh"),CF(2.2*i,8,-4.9)*CFA(-30,0,0)*CF(0,1+2,0)*CFA(30+19.8,0,0)*CF(0,0.5+1.675,0))
  412. newWeld(Torso,Torso2,newPart(0.25,0.25,0.25,mech,nil,"Sphere"),CF(2.2*i,8,-4.9)*CFA(-30,0,0)*CF(0,1+2,0))
  413. newWeld(Torso,Torso2,newPart(0.25,0.25,0.25,mech,nil,"Sphere"),CF(2.2*i,8,-4.9)*CFA(-30,0,0)*CF(0,1+2,0)*CFA(30+19.8,0,0)*CF(0,1+3.35,0))
  414. local p1 = (Torso2.CFrame*CF(2.2*i,17,-3)*CFA(-135-5,0,0)*CF(0,3,0)).p
  415. local p2 = (Torso2.CFrame*CF(4*i,8,-3.2)*CFA(0,0,-10*i)*CF(0,6,0)).p
  416. local len = (p1-p2).magnitude
  417. local cf = CF(p1,p2)*CF(0,0,-len/2)*CFA(-90,0,0)
  418. newWeld(Torso,Torso2,newPart(0.25,len,0.25,mech,nil,"CylinderMesh"),Torso2.CFrame:toObjectSpace(cf))
  419. newWeld(Torso,Torso2,newPart(0.25,0.25,0.25,mech,nil,"Sphere"),Torso2.CFrame:toObjectSpace(cf*CF(0,len/2,0)))
  420. p1 = (Torso2.CFrame*CF(2.2*i,8,-4.9)*CFA(-30,0,0)*CF(0,1+2,0)).p
  421. len = (p1-p2).magnitude
  422. cf = CF(p1,p2)*CF(0,0,-len/2)*CFA(-90,0,0)
  423. newWeld(Torso,Torso2,newPart(0.25,len,0.25,mech,nil,"CylinderMesh"),Torso2.CFrame:toObjectSpace(cf))
  424. p1 = (Torso2.CFrame*CF(4*i,8,-3.2)*CFA(0,0,-10*i)*CF(-0.1*i,2,0)).p
  425. len = (p1-p2).magnitude
  426. cf = CF(p1,p2)*CF(0,0,-len/2)*CFA(-90,0,0)
  427. newWeld(Torso,Torso2,newPart(0.25,len,0.25,mech,nil,"CylinderMesh"),Torso2.CFrame:toObjectSpace(cf))
  428. newWeld(Torso,Torso2,newPart(0.25,0.25,0.25,mech,nil,"Sphere"),Torso2.CFrame:toObjectSpace(cf*CF(0,-len/2,0)))
  429. p2 = (Torso2.CFrame*CF(2.2*i,8,-4.9)*CFA(-30,0,0)*CF(0,1,0)).p
  430. len = (p1-p2).magnitude
  431. cf = CF(p1,p2)*CF(0,0,-len/2)*CFA(-90,0,0)
  432. newWeld(Torso,Torso2,newPart(0.25,len,0.25,mech,nil,"CylinderMesh"),Torso2.CFrame:toObjectSpace(cf))
  433.  
  434. local t1,t2 = fillTriangle1Mech{ --upper glass
  435. (Torso2.CFrame*CF(2.2*i,8,-4.9)*CFA(-30,0,0)*CF(0,1+2,0)).p;
  436. (Torso2.CFrame*CF(2.2*i,17,-3)*CFA(-135-5,0,0)*CF(0,3,0)).p;
  437. (Torso2.CFrame*CF(4*i,8,-3.2)*CFA(0,0,-10*i)*CF(0,6,0)).p;}
  438. CockpitGlass[#CockpitGlass+1] = t1 newI{"SpecialMesh",t1,MeshType="Wedge",Scale=V3(0,1,1)}
  439. CockpitGlass[#CockpitGlass+1] = t2 newI{"SpecialMesh",t2,MeshType="Wedge",Scale=V3(0,1,1)}
  440. local t1,t2 = fillTriangle1Mech{ --mid glass
  441. (Torso2.CFrame*CF(2.2*i,8,-4.9)*CFA(-30,0,0)*CF(0,1+2,0)).p;
  442. (Torso2.CFrame*CF(2.2*i,8,-4.9)*CFA(-30,0,0)*CF(0,1,0)).p;
  443. (Torso2.CFrame*CF(4*i,8,-3.2)*CFA(0,0,-10*i)*CF(-0.1*i,2,0)).p;}
  444. CockpitGlass[#CockpitGlass+1] = t1 newI{"SpecialMesh",t1,MeshType="Wedge",Scale=V3(0,1,1)}
  445. CockpitGlass[#CockpitGlass+1] = t2 newI{"SpecialMesh",t2,MeshType="Wedge",Scale=V3(0,1,1)}
  446. local t1,t2 = fillTriangle1Mech{ --lower glass
  447. (Torso2.CFrame*CF(2.2*i,8,-4.9)*CFA(-30,0,0)*CF(0,1+2,0)).p;
  448. (Torso2.CFrame*CF(4*i,8,-3.2)*CFA(0,0,-10*i)*CF(0,6,0)).p;
  449. (Torso2.CFrame*CF(4*i,8,-3.2)*CFA(0,0,-10*i)*CF(-0.1*i,2,0)).p;}
  450. CockpitGlass[#CockpitGlass+1] = t1 newI{"SpecialMesh",t1,MeshType="Wedge",Scale=V3(0,1,1)}
  451. CockpitGlass[#CockpitGlass+1] = t2 newI{"SpecialMesh",t2,MeshType="Wedge",Scale=V3(0,1,1)}
  452.  
  453. fillTriangle1Mech{ --sidewall upper front
  454. (Torso2.CFrame*CF(2.2*i,17,-3)).p;
  455. (Torso2.CFrame*CF(2.2*i,17,-3)*CFA(-135-5,0,0)*CF(0,3,0)).p;
  456. (Torso2.CFrame*CF(4*i,8,-3.2)*CFA(0,0,-10*i)*CF(0,6,0)).p;}
  457.  
  458. fillTriangle1Mech{ --sidewall lower front
  459. (Torso2.CFrame*CF(2.2*i,8,-4.9)*CFA(-30,0,0)*CF(0,1,0)).p;
  460. (Torso2.CFrame*CF(2.9*i,8,-4)*CFA(0,45*i,-25*i)*CF(0,1,math.sqrt(2*2+2*2)/2+0.1)).p;
  461. (Torso2.CFrame*CF(4*i,8,-3.2)*CFA(0,0,-10*i)*CF(-0.1*i,2,0)).p;}
  462.  
  463. fillTriangle1Mech{ --sides and back ceiling
  464. (Torso2.CFrame*CF(2*i,8,4)).p;
  465. (Torso2.CFrame*CF(2*i,8,4)*CFA(20,0,0)*CF(0,6,0)).p;
  466. (Torso2.CFrame*CF(4*i,8,3)).p;}
  467. fillTriangle1Mech{
  468. (Torso2.CFrame*CF(4*i,8,3)*CFA(0,0,-10*i)*CF(0,6,0)).p;
  469. (Torso2.CFrame*CF(2*i,8,4)*CFA(20,0,0)*CF(0,6,0)).p;
  470. (Torso2.CFrame*CF(4*i,8,3)).p;}
  471. fillTriangle1Mech{
  472. (Torso2.CFrame*CF(4*i,8,3)*CFA(0,0,-10*i)*CF(0,6,0)).p;
  473. (Torso2.CFrame*CF(2*i,8,4)*CFA(20,0,0)*CF(0,6,0)).p;
  474. (Torso2.CFrame*CF(2*i,16.5+0.5,3)).p;}
  475.  
  476.  
  477.  
  478.  
  479. end
  480.  
  481. --roof designs
  482. newWeld(Torso,Torso2,newPart(9,1,1,mech,nil,"Wedge"),CF(0,17.5,-1.5))
  483. newWeld(Torso,Torso2,newPart(4.4,1,2,mech,nil,"Wedge"),CF(0,17.5,-2))
  484. newWeld(Torso,Torso2,newPart(4.4,1,4,mech,nil,"Wedge"),CF(0,18.5, 1))
  485. newWeld(Torso,Torso2,newPart(4.4,2,3,mech,nil,"Wedge"),CF(0,18, 4.5)*CFA(0,180,0))
  486. newWeld(Torso,Torso2,newPart(9,1,4,mech,nil),CF(0,17.5, 1))
  487. newWeld(Torso,Torso2,newPart(4.4,3,3.3,mech,nil,"Wedge"),CF(0,17-1.65, 4.5)*CFA(-90,0,0))
  488.  
  489. LShoulder = newPart(2.6,2.6,2.6,mech,nil,"Dark stone grey","Sphere")
  490. LShoulderW = newWeld6D(Torso2,Torso2,LShoulder,CF(-8,16,0),CF(0,0,0)*CFA(30,0,8))
  491. RShoulder = newPart(2.6,2.6,2.6,mech,nil,"Dark stone grey","Sphere")
  492. RShoulderW = newWeld6D(Torso2,Torso2,RShoulder,CF( 8,16,0),CF(0,0,0)*CFA(30,0,-8))
  493.  
  494. BackBooster = {}
  495. for i=-1,1,2 do --back torso design
  496. local v = newPart(4,4,4,mech,nil,"CylinderMesh")
  497. newWeld(Torso,Torso2,v,CF(4.5*i,15.5,3.75)*CFA(-15,0,5*i))
  498. newWeld(Torso,v,newPart(3.65,2,3.65,mech,nil,"CylinderMesh"),CF(0,-2,0)*CFA(2,0,0)*CF(0,0,0))
  499. newWeld(Torso,v,newPart(3.2,3,3.2,mech,nil,"CylinderMesh"),CF(0,-2,0)*CFA(4,0,0)*CF(0,-1.5,0.1))
  500. local backboost = newPart(2.4,0.2,2.4,mech,nil,"CylinderMesh","Really black","Neon")
  501. newWeld(Torso,v,backboost,CF(0,-2,0)*CFA(4,0,0)*CF(0,-2.91,0.1))
  502. BackBooster[i] = newI{"ParticleEmitter",backboost
  503. ,Lifetime = NumberRange.new(0.8,1)
  504. ,LightEmission=1
  505. ,Color = ColorSequence.new(Color3.new(178/255,248/255,255/255),Color3.new(0/255,0/255,255/255))
  506. ,Texture = assetprefix.."346519018"
  507. ,LockedToPart=true
  508. ,EmissionDirection="Bottom"
  509. ,Rate=600
  510. ,Speed = NumberRange.new(6,6)
  511. ,Rotation = NumberRange.new(-180,-180)
  512. ,RotSpeed = NumberRange.new(-90,-90)
  513. ,VelocitySpread=0
  514. ,Acceleration=V3(0,-15,0)
  515. ,Enabled=false
  516. }
  517. for y=1,6 do
  518. newWeld(Torso,v,newPart(1,1,0.4,mech,nil,"Wedge"),CF(0,-2,0)*CFA(4,0,0)*CF(0,-3-0.5,0.1)*CFA(0,y*60,0)*CF(0,0,1.5-0.2)*CFA(180,0,0))
  519. end
  520. end
  521.  
  522.  
  523. for i,v in pairs{[-1]=LShoulder,[1]=RShoulder} do
  524. newWeld(Torso,v,newPart(3,0.75,3,mech,nil,"CylinderMesh"),CFA(0,0, 50)) --x
  525. newWeld(Torso,v,newPart(3,0.75,3,mech,nil,"CylinderMesh"),CFA(0,0,-50)) --x
  526. newWeld(Torso,Torso2,newPart(6,2.5,2,mech,nil,"Torso"),CF(-5.5*i,17-0.25,0)*CFA(0,90,0)) --shoulder
  527. newWeld(Torso,Torso2,newPart(4.5,2.5,3,mech,nil,"Torso"),CF(-8*i,17+0.5,0)*CFA(0,90,0))
  528.  
  529. newWeld(Torso,Torso2,newPart(1.6,2,2,mech,nil,"Wedge"),CF(-5.5*i,14.5, 1.5)*CFA(180,90*i,0))
  530. newWeld(Torso,Torso2,newPart(1.6,2,2,mech,nil,"Wedge"),CF(-5.5*i,14.5,-1.5)*CFA(180,90*i,0))
  531. newWeld(Torso,Torso2,newPart(5,3,2.5,mech,nil,"Wedge"),CF(-3.5*i,15.5,0.5)*CFA(180,-90*i,0))
  532.  
  533. newWeld(Torso,Torso2,newPart(4.3,2.5,3,mech,nil,"Wedge"),CF(-4.35*i,16.75,3.5)*CFA(180,0,0))
  534.  
  535.  
  536. newWeld(Torso,v,newPart(3,1,3,mech,nil,"Wedge"),CF(0,-11.5, 1)*CFA(180,0, 0))
  537. newWeld(Torso,v,newPart(3,2,1,mech,nil,"Wedge"),CF(0,-11 , -1)*CFA( 0,0,180))
  538. newWeld(Torso,v,newPart(3,1,3,mech,nil,"Wedge"),CF(0,-10.5, 1)*CFA( 0,180,0))
  539.  
  540. newWeld(Torso,v,newPart(2.8,1,2.2,mech,nil,"Wedge"),CF(0,-2.5,0.6)*CFA(180,0, 0))
  541. newWeld(Torso,v,newPart(2.8,2,1,mech,nil,"Wedge"),CF(0,-2 , -1)*CFA( 180,180,180))
  542. newWeld(Torso,v,newPart(2.8,1,2.2,mech,nil,"Wedge"),CF(0,-1.5,0.6)*CFA( 0,180,0))
  543. newWeld(Torso,v,newPart(0.8,1.7,0.8,mech,nil,"CylinderMesh","Dark stone grey"),CF(-0.6,-1.3,0.9)*CFA(-15,0,-7))
  544. newWeld(Torso,v,newPart(0.8,1.7,0.8,mech,nil,"CylinderMesh","Dark stone grey"),CF( 0.6,-1.3,0.9)*CFA(-15,0,7))
  545.  
  546. newWeld(Torso,v,newPart(4,1.42,4,mech,nil,"CylinderMesh","Dark stone grey"),CF(-0.7*i,-4,2)*CFA(0,0,90))--cylinder upper shoulder
  547. newWeld(Torso,v,newPart(3,0.2,3,mech,nil,"CylinderMesh"),CF(-1.5*i,-4,2)*CFA(0,0,90))
  548. newWeld(Torso,v,newPart(4,1.41,4,mech,nil,"CylinderMesh"),CF(-0.7*i,-4-0.25,1.5-0.5)*CFA(0,0,90))
  549. newWeld(Torso,v,newPart(2.05,3.19,2.05,mech,nil,"CylinderMesh","Dark stone grey"),CF(-0.1*i,-4,2)*CFA(0,0,90))
  550. newWeld(Torso,v,newPart(1.5,1.6,1.5,mech,nil,"CylinderMesh","Black"),CF(0.7*i,-4,2)*CFA(0,0,90))
  551. newWeld(Torso,v,newPart(1.4,5,2,mech,nil,"Dark stone grey"),CF(0.69*i,-4,2)*CFA(12.5,0,0)*CF(0,-2.5,0))
  552. newWeld(Torso,v,newPart(1.4,2.8,2,mech,nil,"Dark stone grey"),CF(0.69*i,-4,2)*CFA(129,0,0)*CF(0,-1.4,0))
  553. for x=50,110,30 do
  554. newWeld(Torso,v,newPart(1.3,1.6,1.3,mech,nil,"CylinderMesh","Dark stone grey"),CF(-0.7*i,-4-0.25,1.5-0.5)*CFA(x,0,0)*CF(0,2+0.8,0))
  555. newWeld(Torso,v,newPart(1,0.2,1,mech,nil,"CylinderMesh"),CF(-0.7*i,-4-0.25,1.5-0.5)*CFA(x,0,0)*CF(0,2+1.6-0.09,0))
  556. end
  557. newWeld(Torso,v,newPart(1.4,6.6,1.4,mech,nil,"CylinderMesh"),CF(-0.7*i,-4-0.25,1+2)*CFA( 5,0,0)*CF(0,-3.3,-0.7))
  558. newWeld(Torso,v,newPart(1.4,6,1.4,mech,nil,"CylinderMesh"),CF(-0.7*i,-4-0.25,1-2)*CFA(-2,0,0)*CF(0,-3, 0.7))
  559. newWeld(Torso,v,newPart(1.4,6,2.3,mech,nil),CF(-0.7*i,-7,0.8))
  560.  
  561. newWeld(Torso,v,newPart(4.2,2,3,mech,nil,"Torso"),CF(0,-9.55,0.75)*CFA(14,90,0))
  562.  
  563. end
  564.  
  565. LElbow = newPart(1,1,1,mech,nil)
  566. LElbowW = newWeld6D(LShoulder,LShoulder,LElbow,CF(0,-12,0),CF(0,0,0)*CFA(-90,0,0))
  567. RElbow = newPart(1,1,1,mech,nil)
  568. RElbowW = newWeld6D(RShoulder,RShoulder,RElbow,CF(0,-12,0),CF(0,0,0)*CFA(-90-10,0,0))
  569.  
  570. for i,v in pairs{[-1]=LElbow,[1]=RElbow} do
  571. newWeld(Torso,v,newPart(2.4,3.5,2.4,mech,nil,"CylinderMesh","Dark stone grey"),CF(0,0,0)*CFA(0,0,90))
  572. newWeld(Torso,v,newPart(1.7,3.8,1.7,mech,nil,"CylinderMesh","Black"),CF(0,0,0)*CFA(0,0,90))
  573. newWeld(Torso,v,newPart(3,0.6,3,mech,nil,"CylinderMesh","Really black"),CF(0,0,0)*CFA(0,0,90))
  574. if i == -1 then
  575. newWeld(Torso,v,newPart(2.2,2,2.5,mech,nil,"Torso"),CF(0,-0.5,1.3)*CFA(90,90,0)) --z y x --y z x
  576. newWeld(Torso,v,newPart(1.4,2,1,mech,nil,"Dark stone grey"),CF(0,-1,0))
  577.  
  578. newWeld(Torso,v,newPart(0.75,2.4,0.75,mech,nil,"CylinderMesh","Dark stone grey"),CF(-0.6,-1.6,1.3)*CFA(30,0,0))
  579. newWeld(Torso,v,newPart(0.75,2.4,0.75,mech,nil,"CylinderMesh","Dark stone grey"),CF( 0.6,-1.6,1.3)*CFA(30,0,0))
  580.  
  581. newWeld(Torso,v,newPart(2,2.2,2,mech,nil,"Wedge"),CF(0,-1.9,-1.5))
  582. newWeld(Torso,v,newPart(3,1,2,mech,nil),CF(0,-2.5,0))
  583.  
  584. end
  585. end
  586.  
  587. --Left Arm
  588. newWeld(Torso,LElbow,newPart(3,3.5,4,mech,nil,"Wedge"),CF(0,-3-2,-0.75)*CFA(-90,0,0))
  589. newWeld(Torso,LElbow,newPart(5,4,5,mech,nil,"CylinderMesh","Dark stone grey"),CF(0,-3-2.5,0)*CFA(0,0,90))
  590. newWeld(Torso,LElbow,newPart(2.4,5,2.4,mech,nil,"CylinderMesh","Dark stone grey"),CF(0,-3-2.5,0)*CFA(0,0,90))
  591. newWeld(Torso,LElbow,newPart(4,1.2,4,mech,nil,"CylinderMesh","Black"),CF(0,-3-2.5+1,-1)*CFA(0,0,90))
  592. --newWeld(Torso,LElbow,newPart(4.99,2.3,1.1,mech,nil,"Dark stone grey"),CF(0,-3-2.5-0.5,0))
  593. for i=-1,1,2 do
  594. newWeld(Torso,LElbow,newPart(1,4,4,mech,nil,"Sphere"),CF(2*i,-3-2.5,0)*CFA(0,0,0))
  595. newWeld(Torso,LElbow,newPart(0.7,5,0.7,mech,nil,"CylinderMesh","Dark stone grey"),CF(0.6*i,-3-5+1+1.2+0.5,1.3+1.8-0.45)*CFA(-10,0,0)*CF(0,2.5,0))
  596. end
  597. newWeld(Torso,LElbow,newPart(2.6,6,2.6,mech,nil),CF(0,-3-5-1,0)) --
  598. newWeld(Torso,LElbow,newPart(3.5,6,1.1,mech,nil,"Dark stone grey"),CF(0,-3-5-1,0))
  599. newWeld(Torso,LElbow,newPart(2.6,3,1.8,mech,nil,"Wedge"),CF(0,-3-5+1,1.3+0.9)*CFA(180,0,0))
  600. newWeld(Torso,LElbow,newPart(1,2.6,1,mech,nil,"CylinderMesh"),CF(0,-3-5+1+1.2+0.5,1.3+1.8-0.45)*CFA(0,0,90))
  601. newWeld(Torso,LElbow,newPart(1,1.4,1,mech,nil,"CylinderMesh","Dark stone grey"),CF(0,-3-5-3.5,1.3)*CFA(0,0,90))
  602. newWeld(Torso,LElbow,newPart(1.4,4,1,mech,nil,"Dark stone grey"),CF(0,-3-5-3.5+2,1.3))
  603. newWeld(Torso,LElbow,newPart(1.5,6,1.5,mech,nil,"Dark stone grey","CylinderMesh"),CF(0,-3-5-3.5+2.5,-2.2+1))
  604. newWeld(Torso,LElbow,newPart(2,3,2,mech,nil,"Dark stone grey","CylinderMesh"),CF(0,-3-5,-2.2+1))
  605. newWeld(Torso,LElbow,newPart(2.5,3,2.5,mech,nil,"Dark stone grey","CylinderMesh"),CF(0,-3-3.5,-2.2+1))
  606. newWeld(Torso,LElbow,newPart(2.6,1,1,mech,nil,"Wedge"),CF(0,-3-2.5+1,-2.5-0.5+0.2)*CFA(0,180,0))
  607. newWeld(Torso,LElbow,newPart(2.6,1,1,mech,nil),CF(0,-3-2.5,-2.5-0.5+0.2))
  608. newWeld(Torso,LElbow,newPart(2.6,2,2,mech,nil,"Wedge"),CF(0,-3-2.5-1-0.5,-2.5+0.2)*CFA(0,0,180))
  609.  
  610. LeftGunUse = false
  611. LeftGun = newPart(4,1,4,mech,nil,"CylinderMesh","Dark stone grey")
  612. LeftGunW = newWeld(Torso,LElbow,LeftGun,CF(0,-3-5-4.5,0)*CFA(0,0,0))
  613. newWeld(Torso,LeftGun,newPart(1.6,1,1.6,mech,nil,"Dark stone grey"),CF(0,-1,0))
  614. LeftGunSmoke = newI{"Smoke",LeftGun,Color=Color3.new(20/255,20/255,20/255),Opacity=0.5,Enabled=false,RiseVelocity=-10,Size=2}
  615. for i=120,360,120 do
  616. newWeld(Torso,LeftGun,newPart(1.6,1,1.6,mech,nil,"Dark stone grey"),CF(0,-1,0)*CFA(0,i,0)*CF(0,0,-2+0.8))
  617. newWeld(Torso,LeftGun,newPart(1,1,1,mech,nil,"Ring","Dark stone grey"),CF(0,-1.5-2,0)*CFA(0,i,0)*CF(0,0,-2+0.85)*CFA(90,0,0)).Part1.Mesh.Scale=V3(1.6,1.6,25)
  618. newWeld(Torso,LeftGun,newPart(2.66,1,1,mech,nil,"Dark stone grey"),CF(0,-1,0)*CFA(0,i+60,0)*CF(0,0,-2+0.81))
  619. local ghole = newPart(1.75,0.5,1.75,mech,nil,"Really black","Sphere","Neon")
  620. newWeld(Torso,LeftGun,ghole,CF(0,-1.5-2-0.5,0)*CFA(0,i,0)*CF(0,0,-2+0.85)) -- gun hole
  621. end
  622.  
  623. --Right Arm
  624. local of1 = 2
  625. local of2 = -5.2
  626. newWeld(Torso,RElbow,newPart(3.5,3,2.4,mech,nil,"Dark stone grey"),CFA(-55,0,0)*CF( 0,-1.5,0))
  627. newWeld(Torso,RElbow,newPart(3,4,3,mech,nil,"CylinderMesh","Dark stone grey"),CF( 0,of2+3.5,of1)*CFA(0,0,90))
  628. newWeld(Torso,RElbow,newPart(7,1,2,mech,nil,"Torso"),CF( 0,of2-1,of1-1.5-1.5)*CFA(-90,90,0))
  629. newWeld(Torso,RElbow,newPart(5,0.5,1,mech,nil,"Torso"),CF( 0,of2-5,of1-1.5-1.25)*CFA(-90,90,0))
  630. newWeld(Torso,RElbow,newPart(6,0.8,1.4,mech,nil,"Torso"),CF( 0,of2-1,of1+1.5+1.4)*CFA( 90,90,0))
  631. newWeld(Torso,RElbow,newPart(2,18,1,mech,nil),CF(0,of2-3-3,of1-1.5-0.5)) --upper long
  632. newWeld(Torso,RElbow,newPart(2,18,1,mech,nil),CF(-0.535,of2-3-3,of1-1.5-0.825)*CFA(0, 70,0)*CF(-1,0,0))
  633. newWeld(Torso,RElbow,newPart(2,18,1,mech,nil),CF( 0.535,of2-3-3,of1-1.5-0.825)*CFA(0,-70,0)*CF( 1,0,0))
  634. newWeld(Torso,RElbow,newPart(2,18,1,mech,nil),CF(0,of2-3-3,of1+1.5+0.5)) --lower long
  635. newWeld(Torso,RElbow,newPart(2,18,1,mech,nil),CF(-0.535,of2-3-3,of1+1.5+0.825)*CFA(0,-70,0)*CF(-1,0,0))
  636. newWeld(Torso,RElbow,newPart(2,18,1,mech,nil),CF( 0.535,of2-3-3,of1+1.5+0.825)*CFA(0, 70,0)*CF( 1,0,0))
  637. newWeld(Torso,RElbow,newPart(3.4,2,4,mech,nil,"Wedge"),CF( 0,of2+1,of1-1.5)*CFA(-90,0,180))
  638. newWeld(Torso,RElbow,newPart(3.4,4,2,mech,nil,"Wedge"),CF( 0,of2+1,of1+1.5)*CFA( 0,0,180))
  639. newWeld(Torso,RElbow,newPart(1.7,2,1.7,mech,nil,"CylinderMesh","Dark stone grey"),CF( 0,of2+2,of1)*CFA( 0,0,180))
  640. newWeld(Torso,RElbow,newPart(1.3,2.01,1.3,mech,nil,"CylinderMesh","Really black"),CF( 0,of2+2,of1)*CFA( 0,0,180))
  641.  
  642.  
  643. newWeld(Torso,RElbow,newPart(3.4,1,5,mech,nil),CF( 0,of2+3.5,of1)*CFA( 0,0,180))
  644. newWeld(Torso,RElbow,newPart(3.4,1,5,mech,nil,"Wedge"),CF( 0,of2+1.5,of1+3)*CFA(-90,0,180))
  645. newWeld(Torso,RElbow,newPart(3.4,2,2,mech,nil,"Wedge"),CF( 0,of2+5,of1-1.5)*CFA(0,0,0))
  646. newWeld(Torso,RElbow,newPart(3.4,2,4,mech,nil,"Wedge"),CF( 0,of2+5,of1+1.5)*CFA(0,180,0))
  647.  
  648. newWeld(Torso,RElbow,newPart(2.6,1,3,mech,nil,"Dark stone grey"),CF( 0,of2+5.25,of1+1.5+0.5)*CFA(27,0,0))
  649. for x=60,360,60 do
  650. newWeld(Torso,RElbow,newPart(5,1,3.45,mech,nil),CF( 0,of2+4.5,of1+1.5+0.25)*CFA(27,0,0)*CF(0,1+3,0)*CFA(x,0,0)*CF(0,2.5,0))
  651. end
  652. newWeld(Torso,RElbow,newPart(5.5,4,5.5,mech,nil,"Dark stone grey","CylinderMesh"),CF( 0,of2+4.5,of1+1.5+0.25)*CFA(27,0,0)*CF(0,1+3,0)*CFA(0,0,90))
  653. for i=-1,1,2 do
  654. newWeld(Torso,RElbow,newPart(0.6,0.25,1.6,mech,nil,"Black"),CF(1.2*i,of2-14,of1))
  655. for ii=1,10 do
  656. newWeld(Torso,RElbow,newPart(0.6,0.25,2,mech,nil,"Black"),CF(1.2*i,of2-14.75+ii*1.7,of1)*CFA(ii%2==0 and 56 or -56,0,0))
  657. end
  658. end
  659.  
  660.  
  661. Hatch = newPart(4,6,0.2,mech,nil)
  662. HatchW = newWeld6D(Torso2,Torso2,Hatch,CF(0,11-3,4),CF(0,-3,-0.1)*CFA(-20,0,0)) -- x is -20
  663. newWeld(Torso,Torso2,newPart(4,4.5,0.2,mech,nil),CF(0,8,4)*CFA(20,0,0)*CF(0,6,0)*CFA(-20-42,0,0)*CF(0,2.25,0))
  664.  
  665. Seat = newI{"Seat",mech,Name="Seat",formFactor="Symmetric",Size=V3(2,1,2),TopSurface="SmoothNoOutlines"}
  666. SeatW = newWeld6D(Torso2,Torso2,Seat,CF(0,8.5,0))
  667. newWeld(Torso,Seat,newPart(2,1,1,mech,nil,"Wedge"),CF(0,0,-1.5))
  668. newWeld(Torso,Seat,newPart(2,2.6,0.8,mech,nil),CF(0,0.5+1.15,0.8)*CFA(10,0,0))
  669. newWeld(Torso,Seat,newPart(2,1.2,0.8,mech,nil),CF(0,0.5+2.9,1)*CFA(0,0,0))
  670.  
  671.  
  672. Head = newPart(1,1,1,mech,nil,"nonCollide","Transparent")
  673. Head.Name="Head"
  674. HeadW = newWeld(Torso,Torso,Head,CF(0,2,0))
  675.  
  676. for i,v in pairs(CockpitGlass) do
  677. v.Transparency = 0.6
  678. end
  679. CockpitGlassD = false
  680. for i,v in pairs(mech:children()) do
  681. if v:IsA'BasePart' and v.Material==Enum.Material.SmoothPlastic and v.Transparency==0 then
  682. v.Material="Metal"
  683. end
  684. end
  685.  
  686. Base.Name="HumanoidRootPart" BaseW.Name = "Root Hip"
  687. Torso.Name="Torso"
  688. Torso1.Name = "LowerTorso" Torso1W.Name = "Lower Hip"
  689. Torso2.Name = "UpperTorso" Torso2W.Name = "Upper Hip"
  690. LThigh.Name = "LeftThigh" LThighW.Name = "LThigh"
  691. RThigh.Name = "RightThigh" RThighW.Name = "RThigh"
  692. LLeg.Name = "LeftLeg" LLegW.Name = "LLeg"
  693. RLeg.Name = "RightLeg" RLegW.Name = "RLeg"
  694. LFoot.Name = "LeftFoot" LFootW.Name = "LFoot"
  695. RFoot.Name = "RightFoot" RFootW.Name = "RFoot"
  696. LToe.Name = "LeftToe" LToeW.Name = "LToe"
  697. RToe.Name = "RightToe" RToeW.Name = "RToe"
  698. LShoulder.Name = "LeftShoulder" LShoulderW.Name = "LShoulder"
  699. RShoulder.Name = "RightShoulder" RShoulderW.Name = "RShoulder"
  700. LElbow.Name = "LeftElbow" LElbowW.Name = "LElbow"
  701. RElbow.Name = "RightElbow" RElbowW.Name = "RElbow"
  702. Hatch.Name = "Hatch" HatchW.Name = "Hatch"
  703. SeatW.Name="Seat"
  704.  
  705.  
  706. ----
  707. checkGroundTouch = function()
  708. local Hit1,Pos1 = ray(LToe.Position,LToe.CFrame*CF(0,-1,0).p-LToe.Position,mech,3)
  709. local Hit2,Pos2 = ray(RToe.Position,RToe.CFrame*CF(0,-1,0).p-RToe.Position,mech,3)
  710. if Hit1 or Hit2 then return 1 end
  711. return 0
  712. end
  713. ----
  714.  
  715. doAfterT = {}
  716. doAfter = function(t,f)
  717. local key = (MRND(-100,100)*MRND(-100,100)).."a"..MRND(-999999,999999)
  718. doAfterT[key] = {Time=t,Func=f,Current=0}
  719. return key
  720. end
  721. doInT = {}
  722. doIn = function(t,f,f2)
  723. local key = (MRND(-100,100)*MRND(-100,100)).."a"..MRND(-999999,999999)
  724. doInT[key] = {Time=t,Func=f,FuncEnd=f2,Current=0}
  725. return key
  726. end
  727.  
  728.  
  729. Motors = {["BaseW"]=BaseW,["Torso1W"]=Torso1W,["Torso2W"]=Torso2W,["LThighW"]=LThighW,["RThighW"]=RThighW,["LLegW"]=LLegW,["RLegW"]=RLegW,["LFootW"]=LFootW,["RFootW"]=RFootW,["LToeW"]=LToeW,["RToeW"]=RToeW,
  730. ["LShoulderW"]=LShoulderW,["RShoulderW"]=RShoulderW,["LElbowW"]=LElbowW,["RElbowW"]=RElbowW,["HatchW"]=HatchW,["SeatW"]=SeatW}
  731.  
  732. print(#mech:getChildren().." Parts")
  733. _G.mech = mech
  734. _G.RMM2 = getfenv()
  735. _G.m = _G.RMM2
  736.  
  737. gw = function()
  738. print(" ")
  739. for i,weldn in pairs{"LThighW","LLegW","LFootW","LToeW","RThighW","RLegW","RFootW","RToeW","LShoulderW","LElbowW","RShoulderW","RElbowW","BaseW","Torso1W","Torso2W","HatchW","SeatW"} do
  740. weld = getfenv()[weldn]
  741. local a,b,c = weld.C0:toEulerAnglesXYZ()
  742. local d,e,f = weld.C1:toEulerAnglesXYZ()
  743. inde = function(n)
  744. n = math.floor(n*1000+0.5)/1000
  745. return string.rep(" ",5-#(""..n))..n
  746. end
  747. --print(weldn..".C0 = CF("..inde(weld.C0.x)..","..inde(weld.C0.y)..","..inde(weld.C0.z)..")*CFA("..inde(MD(a))..","..inde(MD(b))..","..inde(MD(c))..")")
  748. print(" addAnim("..weldn..string.rep(" ",10-#weldn)..",1,t,nil,{"..inde(weld.C1.x)..","..inde(weld.C1.y)..","..inde(weld.C1.z)..","..inde(MD(d))..","..inde(MD(e))..","..inde(MD(f)).."})")
  749. end
  750. print(" ")
  751. end
  752. gwBool = newI{"BoolValue",mech,Name="GetWelds"}
  753. gwBool.Changed:connect(function()
  754. if not gwBool.Value then return end
  755. gwBool.Value=false
  756. gw()
  757. end)
  758. gw2 = function()
  759. print(" ")
  760. for i,weldn in pairs{"LS","RS","LH","RH"} do
  761. weld = getfenv()[weldn]
  762. local a,b,c = weld.C0:toEulerAnglesXYZ()
  763. local d,e,f = weld.C1:toEulerAnglesXYZ()
  764. inde = function(n)
  765. n = math.floor(n*1000+0.5)/1000
  766. return string.rep(" ",5-#(""..n))..n
  767. end
  768. print(" addAnim("..weldn..string.rep(" ",10-#weldn)..",0,t,nil,{"..inde(weld.C0.x)..","..inde(weld.C0.y)..","..inde(weld.C0.z)..","..inde(MD(a))..","..inde(MD(b))..","..inde(MD(c)).."})")
  769. print(" addAnim("..weldn..string.rep(" ",10-#weldn)..",1,t,nil,{"..inde(weld.C1.x)..","..inde(weld.C1.y)..","..inde(weld.C1.z)..","..inde(MD(d))..","..inde(MD(e))..","..inde(MD(f)).."})")
  770. end
  771. print(" ")
  772. end
  773. ------
  774. Anims = {} -- {WELD,C0or1,Time,CFStart,CFEnd,Current}
  775. addAnim = function(weld,C0or1,Time,CFStart,CFEnd)
  776. if not weld then return end
  777. local CC = "C"..C0or1
  778. if not CFStart then
  779. local a,b,c = weld[CC]:toEulerAnglesXYZ()
  780. CFStart = {weld[CC].x,weld[CC].y,weld[CC].z,MD(a),MD(b),MD(c)}
  781. end
  782. if not CFEnd[1] and not CFEnd[2] and not CFEnd[3] then
  783. CFEnd[1] = weld[CC].x
  784. CFEnd[2] = weld[CC].y
  785. CFEnd[3] = weld[CC].z
  786. end
  787. Anims[weld.Name..CC] = {weld=weld,CC="C"..C0or1,CFStart=CFStart,CFEnd=CFEnd,Time=Time,Current=0}
  788. end
  789. --
  790. WalkKey = {}
  791. loadAnim = {} _G.la = loadAnim
  792. --
  793. ClearWalk = function()
  794. for i,v in pairs(WalkKey) do
  795. doAfterT[i] = nil
  796. WalkKey[i] = nil
  797. end
  798. end
  799. --
  800. loadAnim.Open = function(a,t)
  801. t = t or 1.5
  802. addAnim(LThighW ,1,t,nil,{nil,nil,nil, -75, 0, 0})
  803. addAnim(LLegW ,1,t,nil,{nil,nil,nil, 155, 0, 0})
  804. addAnim(LFootW ,1,t,nil,{nil,nil,nil, -80, 0, 0})
  805. addAnim(LToeW ,1,t,nil,{nil,nil,nil, 0, 0, 0})
  806. addAnim(RThighW ,1,t,nil,{nil,nil,nil, -75, 0, 0})
  807. addAnim(RLegW ,1,t,nil,{nil,nil,nil, 155, 0, 0})
  808. addAnim(RFootW ,1,t,nil,{nil,nil,nil, -80, 0, 0})
  809. addAnim(RToeW ,1,t,nil,{nil,nil,nil, 0, 0, 0})
  810. addAnim(LShoulderW,1,t,nil,{nil,nil,nil, 20, 0, 8})
  811. addAnim(LElbowW ,1,t,nil,{nil,nil,nil, -90, 0, 0})
  812. addAnim(RShoulderW,1,t,nil,{nil,nil,nil, -20, 0, -8})
  813. addAnim(RElbowW ,1,t,nil,{nil,nil,nil, -60, 0, 0})
  814. addAnim(BaseW ,1,t,nil,{ 0,10.2-10.2, 0, 0, 0, 0})
  815. addAnim(Torso1W ,1,t,nil,{nil,nil,nil, 0, 0, 0})
  816. addAnim(Torso2W ,1,t,nil,{nil,nil,nil, 0, 0, 0})
  817. addAnim(HatchW ,1,t,nil,{nil,nil,nil,-180, 0, 0})
  818. addAnim(SeatW ,0,t,nil,{-0.6,8.5, 5, 0, 180, 0})
  819. doAfter(t,function() addAnim(SeatW ,0,t*0.5,nil,{ 0, -1, 5.3, 0, 180, 0}) end)
  820. end
  821. loadAnim.Close = function(a,t)
  822. addAnim(SeatW ,0,t*0.5,nil,{ -0.6, 8.5, 5, 0, 180, 0})
  823. doAfter(t*0.5,function() loadAnim:Standing(1) end)
  824. end
  825. loadAnim.Standing = function(a,t)
  826. t = t or 1
  827. addAnim(LThighW ,1,t,nil,{ 1.5, 0.5, 0, -25, 0, 0})
  828. addAnim(LLegW ,1,t,nil,{ 0, 0, 0, 75, 0, 0})
  829. addAnim(LFootW ,1,t,nil,{ 0, 0, 0, 10, 0, 0})
  830. addAnim(LToeW ,1,t,nil,{ 0, 0, 0, -60, 0, 0})
  831. addAnim(RThighW ,1,t,nil,{ -1.5, 0.5, 0, -25, 0, 0})
  832. addAnim(RLegW ,1,t,nil,{ 0, 0, 0, 75, 0, 0})
  833. addAnim(RFootW ,1,t,nil,{ 0, 0, 0, 10, 0, 0})
  834. addAnim(RToeW ,1,t,nil,{ 0, 0, 0, -60, 0, 0})
  835. addAnim(LShoulderW,1,t,nil,{ 0, 0, 0, 30, 0, 8})
  836. addAnim(LElbowW ,1,t,nil,{ 0, 0, 0, -90, 0, 0})
  837. addAnim(RShoulderW,1,t,nil,{ 0, 0, 0, 30, 0, -8})
  838. addAnim(RElbowW ,1,t,nil,{ 0, 0, 0, -100, 0, 0})
  839. addAnim(BaseW ,1,t,nil,{ 0, 0, 0, 0, 0, 0})
  840. addAnim(Torso1W ,1,t,nil,{ 0, 0, 0, 0, 0, 0})
  841. addAnim(Torso2W ,1,t,nil,{ 0, 0, 0, 0, 0, 0})
  842. addAnim(HatchW ,1,t,nil,{ 0, -3, -0.1, -20, 0, 0})
  843. addAnim(SeatW ,0,t,nil,{ 0, 8.5, 0, 0, 0, 0})
  844. end
  845. loadAnim.ReturnLeg = function(a,t)
  846. t = t or 0.5
  847. addAnim(LThighW ,1,t,nil,{ 1.5, 0.5, 0, -25, 0, 0})
  848. addAnim(LLegW ,1,t,nil,{ 0, 0, 0, 75, 0, 0})
  849. addAnim(LFootW ,1,t,nil,{ 0, 0, 0, 10, 0, 0})
  850. addAnim(LToeW ,1,t,nil,{ 0, 0, 0, -60, 0, 0})
  851. addAnim(RThighW ,1,t,nil,{ -1.5, 0.5, 0, -25, 0, 0})
  852. addAnim(RLegW ,1,t,nil,{ 0, 0, 0, 75, 0, 0})
  853. addAnim(RFootW ,1,t,nil,{ 0, 0, 0, 10, 0, 0})
  854. addAnim(RToeW ,1,t,nil,{ 0, 0, 0, -60, 0, 0})
  855. end
  856. loadAnim.ReturnArm = function(a,t)
  857. t = t or 0.5
  858. addAnim(LShoulderW,1,t,nil,{ 0, 0, 0, 30, 0, 8})
  859. addAnim(LElbowW ,1,t,nil,{ 0, 0, 0, -90, 0, 0})
  860. addAnim(RShoulderW,1,t,nil,{ 0, 0, 0, 30, 0, -8})
  861. addAnim(RElbowW ,1,t,nil,{ 0, 0, 0, -100, 0, 0})
  862. end
  863. loadAnim.WalkL = function(a,t)
  864. local WalkSpeed = 0.3
  865. local tu = Turn==0 and 0 or (Turn<0 and 45 or -45)
  866. addAnim(LThighW ,1,WalkSpeed ,nil,{ nil, nil, nil, -65, tu, 0})
  867. addAnim(LLegW ,1,WalkSpeed ,nil,{ 0, 0, 0, 115, 0, 0})
  868. addAnim(LFootW ,1,WalkSpeed ,nil,{ 0, 0, 0, -20, 0, 0})
  869. addAnim(LToeW ,1,WalkSpeed ,nil,{ 0, 0, 0, -30, 0, 0})
  870. addAnim(RThighW ,1,WalkSpeed*2,nil,{ nil, nil, nil, 15, tu, 0})
  871. addAnim(RLegW ,1,WalkSpeed*2,nil,{ 0, 0, 0, 35, 0, 0})
  872. addAnim(RFootW ,1,WalkSpeed*2,nil,{ 0, 0, 0, 30, 0, 0})
  873. addAnim(RToeW ,1,WalkSpeed*2,nil,{ 0, 0, 0, -80, 0, 0})
  874. wkey = doAfter(WalkSpeed,function()
  875. addAnim(LThighW ,1,WalkSpeed,nil,{ nil, nil, nil, -45, tu, 0})
  876. addAnim(LLegW ,1,WalkSpeed,nil,{ 0, 0, 0, 35, 0, 0})
  877. addAnim(LFootW ,1,WalkSpeed,nil,{ 0, 0, 0, 60, 0, 0})
  878. addAnim(LToeW ,1,WalkSpeed,nil,{ 0, 0, 0, -50, 0, 0})
  879. end)
  880. WalkKey[wkey] = true
  881. wkey = doAfter(WalkSpeed*2,function()
  882. addAnim(LThighW ,1,WalkSpeed,nil,{ nil, nil, nil, -20, tu, 0})
  883. addAnim(LLegW ,1,WalkSpeed,nil,{ 0, 0, 0, 65, 0, 0})
  884. addAnim(LFootW ,1,WalkSpeed,nil,{ 0, 0, 0, 10, 0, 0})
  885. addAnim(LToeW ,1,WalkSpeed,nil,{ 0, 0, 0, -50, 0, 0})
  886. addAnim(RThighW ,1,WalkSpeed,nil,{ nil, nil, nil, -35, tu, 0})
  887. addAnim(RLegW ,1,WalkSpeed,nil,{ 0, 0, 0, 105, 0, 0})
  888. addAnim(RFootW ,1,WalkSpeed,nil,{ 0, 0, 0, 40, 0, 0})
  889. addAnim(RToeW ,1,WalkSpeed,nil,{ 0, 0, 0, -40, 0, 0})
  890. end)
  891. WalkKey[wkey] = true
  892. end
  893. loadAnim.WalkR = function(a,t)
  894. local WalkSpeed = 0.3
  895. local tu = Turn==0 and 0 or (Turn<0 and 45 or -45)
  896. addAnim(LThighW ,1,WalkSpeed*2,nil,{ nil, nil, nil, 15, tu, 0})
  897. addAnim(LLegW ,1,WalkSpeed*2,nil,{ 0, 0, 0, 35, 0, 0})
  898. addAnim(LFootW ,1,WalkSpeed*2,nil,{ 0, 0, 0, 30, 0, 0})
  899. addAnim(LToeW ,1,WalkSpeed*2,nil,{ 0, 0, 0, -80, 0, 0})
  900. addAnim(RThighW ,1,WalkSpeed ,nil,{ nil, nil, nil, -65, tu, 0})
  901. addAnim(RLegW ,1,WalkSpeed ,nil,{ 0, 0, 0, 115, 0, 0})
  902. addAnim(RFootW ,1,WalkSpeed ,nil,{ 0, 0, 0, -20, 0, 0})
  903. addAnim(RToeW ,1,WalkSpeed ,nil,{ 0, 0, 0, -30, 0, 0})
  904. wkey = doAfter(WalkSpeed,function()
  905. addAnim(RThighW ,1,WalkSpeed,nil,{ nil, nil, nil, -45, tu, 0})
  906. addAnim(RLegW ,1,WalkSpeed,nil,{ 0, 0, 0, 35, 0, 0})
  907. addAnim(RFootW ,1,WalkSpeed,nil,{ 0, 0, 0, 60, 0, 0})
  908. addAnim(RToeW ,1,WalkSpeed,nil,{ 0, 0, 0, -50, 0, 0})
  909. end)
  910. WalkKey[wkey] = true
  911. wkey = doAfter(WalkSpeed*2,function()
  912. addAnim(LThighW ,1,WalkSpeed,nil,{ nil, nil, nil, -35, tu, 0})
  913. addAnim(LLegW ,1,WalkSpeed,nil,{ 0, 0, 0, 105, 0, 0})
  914. addAnim(LFootW ,1,WalkSpeed,nil,{ 0, 0, 0, 40, 0, 0})
  915. addAnim(LToeW ,1,WalkSpeed,nil,{ 0, 0, 0, -40, 0, 0})
  916. addAnim(RThighW ,1,WalkSpeed,nil,{ nil, nil, nil, -20, tu, 0})
  917. addAnim(RLegW ,1,WalkSpeed,nil,{ 0, 0, 0, 65, 0, 0})
  918. addAnim(RFootW ,1,WalkSpeed,nil,{ 0, 0, 0, 10, 0, 0})
  919. addAnim(RToeW ,1,WalkSpeed,nil,{ 0, 0, 0, -50, 0, 0})
  920. end)
  921. WalkKey[wkey] = true
  922. end
  923. loadAnim.Walk2L = function(a,t)
  924. local WalkSpeed = 0.4
  925. local tu = Turn==0 and 0 or (Turn<0 and 45 or -45)
  926. addAnim(LThighW ,1,WalkSpeed ,nil,{ nil, nil, nil, -15, tu, 0})
  927. addAnim(LLegW ,1,WalkSpeed ,nil,{ 0, 0, 0, 105, 0, 0})
  928. addAnim(LFootW ,1,WalkSpeed ,nil,{ 0, 0, 0,24.286, 0, 0})
  929. addAnim(LToeW ,1,WalkSpeed ,nil,{ 0, 0, 0,-74.286, 0, 0})
  930. addAnim(RThighW ,1,WalkSpeed*2,nil,{ nil, nil, nil, -45, tu, 0})
  931. addAnim(RLegW ,1,WalkSpeed*2,nil,{ 0, 0, 0, 45, 0, 0})
  932. addAnim(RFootW ,1,WalkSpeed*2,nil,{ 0, 0, 0, 50, 0, 0})
  933. addAnim(RToeW ,1,WalkSpeed*2,nil,{ 0, 0, 0, -50, 0, 0})
  934. wkey = doAfter(WalkSpeed,function()
  935. addAnim(LThighW ,1,WalkSpeed,nil,{ nil, nil, nil, 15, tu, 0})
  936. addAnim(LLegW ,1,WalkSpeed,nil,{ 0, 0, 0, 35, 0, 0})
  937. addAnim(LFootW ,1,WalkSpeed,nil,{ 0, 0, 0, 30, 0, 0})
  938. addAnim(LToeW ,1,WalkSpeed,nil,{ 0, 0, 0, -80, 0, 0})
  939. end)
  940. WalkKey[wkey] = true
  941. end
  942. loadAnim.Walk2R = function(a,t)
  943. local WalkSpeed = 0.4
  944. local tu = Turn==0 and 0 or (Turn<0 and 45 or -45)
  945. addAnim(LThighW ,1,WalkSpeed*2,nil,{ nil, nil, nil, -45, tu, 0})
  946. addAnim(LLegW ,1,WalkSpeed*2,nil,{ 0, 0, 0, 45, 0, 0})
  947. addAnim(LFootW ,1,WalkSpeed*2,nil,{ 0, 0, 0, 50, 0, 0})
  948. addAnim(LToeW ,1,WalkSpeed*2,nil,{ 0, 0, 0, -50, 0, 0})
  949. addAnim(RThighW ,1,WalkSpeed ,nil,{ nil, nil, nil, -15, tu, 0})
  950. addAnim(RLegW ,1,WalkSpeed ,nil,{ 0, 0, 0, 105, 0, 0})
  951. addAnim(RFootW ,1,WalkSpeed ,nil,{ 0, 0, 0,24.286, 0, 0})
  952. addAnim(RToeW ,1,WalkSpeed ,nil,{ 0, 0, 0,-74.286, 0, 0})
  953. wkey = doAfter(WalkSpeed,function()
  954. addAnim(RThighW ,1,WalkSpeed,nil,{ nil, nil, nil, 15, tu, 0})
  955. addAnim(RLegW ,1,WalkSpeed,nil,{ 0, 0, 0, 35, 0, 0})
  956. addAnim(RFootW ,1,WalkSpeed,nil,{ 0, 0, 0, 30, 0, 0})
  957. addAnim(RToeW ,1,WalkSpeed,nil,{ 0, 0, 0, -80, 0, 0})
  958. end)
  959. WalkKey[wkey] = true
  960. end
  961. loadAnim.RunL = function(a,t)
  962. local WalkSpeed = 0.24
  963. addAnim(LThighW ,1,WalkSpeed ,nil,{ nil, nil, nil, -105, 0, 0})
  964. addAnim(LLegW ,1,WalkSpeed ,nil,{ 0, 0, 0, 115, 0, 0})
  965. addAnim(LFootW ,1,WalkSpeed ,nil,{ 0, 0, 0, 10, 0, 0})
  966. addAnim(LToeW ,1,WalkSpeed ,nil,{ 0, 0, 0, -40, 0, 0})
  967. addAnim(RThighW ,1,WalkSpeed*1.5,nil,{ nil, nil, nil, 50, 0, 0})
  968. addAnim(RLegW ,1,WalkSpeed*1.5,nil,{ 0, 0, 0, 5, 0, 0})
  969. addAnim(RFootW ,1,WalkSpeed*1.5,nil,{ 0, 0, 0, 10, 0, 0})
  970. addAnim(RToeW ,1,WalkSpeed*1.5,nil,{ 0, 0, 0, -65, 0, 0})
  971. wkey = doAfter(WalkSpeed,function()
  972. WalkSpeed = 0.12
  973. addAnim(LThighW ,1,WalkSpeed,nil,{ nil, nil, nil, -75, 0, 0})
  974. addAnim(LLegW ,1,WalkSpeed,nil,{ 0, 0, 0, 75, 0, 0})
  975. addAnim(LFootW ,1,WalkSpeed,nil,{ 0, 0, 0, 40, 0, 0})
  976. addAnim(LToeW ,1,WalkSpeed,nil,{ 0, 0, 0, -40, 0, 0})
  977. end)
  978. WalkKey[wkey] = true
  979. end
  980. loadAnim.RunR = function(a,t)
  981. local WalkSpeed = 0.24
  982. addAnim(LThighW ,1,WalkSpeed*1.5,nil,{ nil, nil, nil, 50, 0, 0})
  983. addAnim(LLegW ,1,WalkSpeed*1.5,nil,{ 0, 0, 0, 5, 0, 0})
  984. addAnim(LFootW ,1,WalkSpeed*1.5,nil,{ 0, 0, 0, 10, 0, 0})
  985. addAnim(LToeW ,1,WalkSpeed*1.5,nil,{ 0, 0, 0, -65, 0, 0})
  986. addAnim(RThighW ,1,WalkSpeed ,nil,{ nil, nil, nil, -105, 0, 0})
  987. addAnim(RLegW ,1,WalkSpeed ,nil,{ 0, 0, 0, 115, 0, 0})
  988. addAnim(RFootW ,1,WalkSpeed ,nil,{ 0, 0, 0, 10, 0, 0})
  989. addAnim(RToeW ,1,WalkSpeed ,nil,{ 0, 0, 0, -30, 0, 0})
  990. wkey = doAfter(WalkSpeed,function()
  991. WalkSpeed = 0.12
  992. addAnim(RThighW ,1,WalkSpeed,nil,{ nil, nil, nil, -75, 0, 0})
  993. addAnim(RLegW ,1,WalkSpeed,nil,{ 0, 0, 0, 75, 0, 0})
  994. addAnim(RFootW ,1,WalkSpeed,nil,{ 0, 0, 0, 40, 0, 0})
  995. addAnim(RToeW ,1,WalkSpeed,nil,{ 0, 0, 0, -30, 0, 0})
  996. end)
  997. WalkKey[wkey] = true
  998. end
  999. loadAnim.Jump = function(a,t)
  1000. local t = 0.4
  1001. addAnim(LThighW ,1,t,nil,{ 1.5, 0.5, 0,-74.779,-9.656,2.613})
  1002. addAnim(LLegW ,1,t,nil,{ 0, 0, 0, 155, 0, 0})
  1003. addAnim(LFootW ,1,t,nil,{ 0, 0, 0, -80, 0, 0})
  1004. addAnim(LToeW ,1,t,nil,{ 0, 0, 0, 0, 0, 0})
  1005. addAnim(RThighW ,1,t,nil,{ -1.5, 0.5, 0,-84.923,9.962,-0.88})
  1006. addAnim(RLegW ,1,t,nil,{ 0, 0, 0, 155, 0, 0})
  1007. addAnim(RFootW ,1,t,nil,{ 0, 0, 0, -70, 0, 0})
  1008. addAnim(RToeW ,1,t,nil,{ 0, 0, 0, 0, 0, 0})
  1009. addAnim(LShoulderW,1,t,nil,{ 0, 0, 0, 10, 0, 8})
  1010. addAnim(LElbowW ,1,t,nil,{ 0, 0, 0, -110, 0, 0})
  1011. addAnim(RShoulderW,1,t,nil,{ 0, 0, 0, 30, 0, -8})
  1012. addAnim(RElbowW ,1,t,nil,{ 0, 0, 0, -130, 0, 0})
  1013. addAnim(Torso1W ,1,t,nil,{ 0, 0, 0, 20, 0, 0})
  1014. doAfter(t,function()
  1015. local t = 0.2
  1016. addAnim(LThighW ,1,t,nil,{ 1.5, 0.5, 0,-15.455,-19.312,-0.077})
  1017. addAnim(LLegW ,1,t,nil,{ 0, 0, 0, 85, 0, 0})
  1018. addAnim(LFootW ,1,t,nil,{ 0, 0, 0, -10, 0, 0})
  1019. addAnim(LToeW ,1,t,nil,{ 0, 0, 0, -30, 0, 0})
  1020. addAnim(RThighW ,1,t,nil,{ -1.5, 0.5, 0,-14.923,9.962,-0.88})
  1021. addAnim(RLegW ,1,t,nil,{ 0, 0, 0, 85, 0, 0})
  1022. addAnim(RFootW ,1,t,nil,{ 0, 0, 0, -10, 0, 0})
  1023. addAnim(RToeW ,1,t,nil,{ 0, 0, 0, -30, 0, 0})
  1024. addAnim(Torso1W ,1,t,nil,{ 0, 0, 0, 0, 0, 0})
  1025. end)
  1026. end
  1027. Base.CanCollide=false
  1028. --------------------------------------------------------------------------
  1029. Player = Players.LocalPlayer
  1030. if not Player then print'not found' mech:MoveTo(V3(0,0,0)) return end
  1031. Hum = newI{"Humanoid",mech} Hum.PlatformStand=true
  1032. Char = Player.Character
  1033. CTorso = Char.Torso
  1034. CHRP = Char.HumanoidRootPart
  1035. LS = CTorso:findFirstChild'Left Shoulder'
  1036. RS = CTorso:findFirstChild'Right Shoulder'
  1037. LH = CTorso:findFirstChild'Left Hip'
  1038. RH = CTorso:findFirstChild'Right Hip'
  1039.  
  1040. if Char:findFirstChild(mech.Name) then Char[mech.Name]:Destroy() end
  1041. mech.Parent = Char
  1042. Base.Name="HRP"
  1043. ------
  1044. Pilot = nil
  1045. Anim = "Opening"
  1046. AnimLegs = true --use leg pose
  1047. AnimArms = true --use arm pose
  1048. AnimTorso = true --use torso pose
  1049. WalkDir = 0
  1050. ------
  1051. SeatWeld = nil
  1052. Seat.ChildAdded:connect(function(weld)
  1053. SeatWeld = weld
  1054. Pilot = weld.Part1==CHRP and CHRP or nil
  1055. pcall(function()
  1056. weld.C1 = CF(0,-1.5,0.25)*CFA(-95,0,0)
  1057. LS2 = weld.Part1.Parent.Torso:findFirstChild'Left Shoulder' LS2.Parent = nil
  1058. RS2 = weld.Part1.Parent.Torso:findFirstChild'Right Shoulder' RS2.Parent = nil
  1059. LH2 = weld.Part1.Parent.Torso:findFirstChild'Left Hip' LH2.Parent = nil
  1060. RH2 = weld.Part1.Parent.Torso:findFirstChild'Right Hip' RH2.Parent = nil
  1061. LS1 = newI{"Weld",weld.Part1.Parent.Torso,Part0=weld.Part1.Parent.Torso,Part1=weld.Part1.Parent:findFirstChild'Left Arm' ,Name="RM1"}
  1062. RS1 = newI{"Weld",weld.Part1.Parent.Torso,Part0=weld.Part1.Parent.Torso,Part1=weld.Part1.Parent:findFirstChild'Right Arm',Name="RM2"}
  1063. LH1 = newI{"Weld",weld.Part1.Parent.Torso,Part0=weld.Part1.Parent.Torso,Part1=weld.Part1.Parent:findFirstChild'Left Leg' ,Name="RM3"}
  1064. RH1 = newI{"Weld",weld.Part1.Parent.Torso,Part0=weld.Part1.Parent.Torso,Part1=weld.Part1.Parent:findFirstChild'Right Leg',Name="RM4"}
  1065. LS1.C0 = CF(-1.2,0.5,-0.5)*CFA(0,0,0)
  1066. LS1.C1 = CF( 0,0.5,0)*CFA(-80,-10,10)
  1067. RS1.C0 = CF( 1.2,0.5,-0.5)*CFA(0,0,0)
  1068. RS1.C1 = CF( 0,0.5,0)*CFA(-80, 10,-10)
  1069. LH1.C0 = CF(-0.5, -1,-0.3)*CFA(0,0,0)
  1070. LH1.C1 = CF( 0, 1,0)*CFA(-45,0, 5)
  1071. RH1.C0 = CF( 0.5, -1,-0.3)*CFA(0,0,0)
  1072. RH1.C1 = CF( 0, 1,0)*CFA(-45,0,-5)
  1073. end)
  1074. end)
  1075. Seat.ChildRemoved:connect(function(weld)
  1076. pcall(function()
  1077. local mm = weld.Part1.Parent
  1078. for i=1,4 do
  1079. mm.Torso["RM"..i]:Destroy()
  1080. end
  1081. LS2.Parent = mm.Torso
  1082. LS2.Part0 = mm.Torso
  1083. LS2.Part1 = mm["Left Arm"]
  1084. RS2.Parent = mm.Torso
  1085. RS2.Part0 = mm.Torso
  1086. RS2.Part1 = mm["Right Arm"]
  1087. LH2.Parent = mm.Torso
  1088. LH2.Part0 = mm.Torso
  1089. LH2.Part1 = mm["Left Leg"]
  1090. RH2.Parent = mm.Torso
  1091. RH2.Part0 = mm.Torso
  1092. RH2.Part1 = mm["Right Leg"]
  1093. end)
  1094. Pilot = nil
  1095. end)
  1096. ------
  1097. Gyro = newI{"BodyGyro",Base,cframe=Base.CFrame,maxTorque=V3(5000000,5000000,5000000),P=15000}
  1098. WeightForce = newI{"BodyForce",Base,Force=V3(0,-1000000,0)}
  1099. Turn = 0
  1100. Velo = newI{"BodyVelocity",Base,maxForce=V3N}
  1101. veloym = 0
  1102. veloy = 0
  1103. ------
  1104. Mouse = Player:GetMouse()
  1105. Key = {}
  1106. --[[
  1107. X Open/Close
  1108. C Jump
  1109. WASD Movement
  1110. P Cockpit glass
  1111. --]]
  1112. WalkingSpeed = 16
  1113. onKeyDown = function(k)
  1114. if k=="a" then
  1115. Turn = 10
  1116. elseif k=="d" then
  1117. Turn = -10
  1118. end
  1119. --
  1120. if k=="x" and Anim=="Opened" then
  1121. Anim="Closing"
  1122. AnimLegs,AnimArms,AnimTorso,Movement=false,false,false,false
  1123. loadAnim:Close(2)
  1124. wait(2)
  1125. Anim="None"
  1126. AnimLegs,AnimArms,AnimTorso,Movement=true,true,true,true
  1127. elseif k=="x" and Anim=="None" then
  1128. Anim="Opening"
  1129. ClearWalk()
  1130. AnimLegs,AnimArms,AnimTorso,Movement=false,false,false,false
  1131. loadAnim:Open(2)
  1132. wait(3)
  1133. Anim="Opened"
  1134. elseif (k=="w" or k=="a" or k=="d") and not Key.s and Movement and Pilot and WalkDir~=1 and AnimLegs then
  1135. WalkDir=1
  1136. ClearWalk()
  1137. local whichLeg = -1
  1138. while (Key.w or Key.a or Key.d) and not Key.s and Movement and Pilot do
  1139. loadAnim[(Key["0"] and "Run" or "Walk")..(whichLeg==-1 and "L" or "R")]()
  1140. WalkingSpeed = Key["0"] and 18*4.5 or 18
  1141. whichLeg = whichLeg*-1
  1142. if not AnimLegs then repeat wait() until AnimLegs end
  1143. local duration = (Key["0"] and 0.36 or 0.9)
  1144. for i=duration/8,duration,duration/8 do wait(duration/8) if (Key.w or Key.a or Key.d) and not Key.s and Movement and Pilot then else break end end
  1145. if not AnimLegs then repeat wait() until AnimLegs end
  1146. end
  1147. WalkDir=0
  1148. ClearWalk()
  1149. if Movement and Anim=="None" then
  1150. loadAnim:Standing(0.5)
  1151. end
  1152. elseif k=="s" and not Key.w and Movement and Pilot and AnimLegs then
  1153. WalkDir=-1
  1154. ClearWalk()
  1155. local whichLeg = -1
  1156. while Key.s and not Key.w and Movement and Pilot do
  1157. loadAnim["Walk2"..(whichLeg==-1 and "L" or "R")]()
  1158. whichLeg = whichLeg*-1
  1159. if not AnimLegs then repeat wait() until AnimLegs end
  1160. for i=0.1,0.8,0.1 do wait(0.1) if Key.s and not Key.w and Movement and Pilot then else break end end
  1161. if not AnimLegs then repeat wait() until AnimLegs end
  1162. end
  1163. WalkDir=0
  1164. ClearWalk()
  1165. if Movement and Anim=="None" then
  1166. loadAnim:Standing(0.5)
  1167. end
  1168. elseif k=="c" and Movement and Pilot and AnimLegs and AnimTorso and checkGroundTouch()>0 then
  1169. AnimLegs,AnimArms,AnimTorso=false,false,false
  1170. ClearWalk()
  1171. loadAnim:Jump()
  1172. wait(0.5)
  1173. AnimTorso=true
  1174. AnimArms=true
  1175. veloym = 10000000
  1176. loadAnim:ReturnArm(0.3)
  1177. if Key.c then BackBooster[-1].Enabled = true BackBooster[1].Enabled = true veloy = 100 wait(1) else veloy = 75 wait(0.5) end
  1178. BackBooster[-1].Enabled = false BackBooster[1].Enabled = false
  1179. veloym = 0
  1180. veloy = 0
  1181. AnimLegs=true
  1182. if WalkDir==0 then loadAnim:ReturnLeg() end
  1183. elseif k=="p" and not CockpitGlassD and Pilot then
  1184. CockpitGlassD = true
  1185. if CockpitGlass[1].Transparency==0 then
  1186. doIn(0.7,function(i)
  1187. for x,v in pairs(CockpitGlass) do
  1188. v.Transparency = 0.6*i
  1189. end
  1190. end)
  1191. else
  1192. doIn(0.7,function(i)
  1193. for x,v in pairs(CockpitGlass) do
  1194. v.Transparency = 0.6-0.6*i
  1195. end
  1196. end)
  1197. end
  1198. wait(0.8)
  1199. CockpitGlassD = false
  1200. elseif k =="q" and not LeftGunUse then
  1201. LeftGunUse=true
  1202. if not spinSpeed then spinSpeed=0 end
  1203. for i=1,50 do
  1204. if spinSpeed>40 then spinSpeed=40 end
  1205. LeftGunW.C1=LeftGunW.C1*CFA(0,spinSpeed,0)
  1206. spinSpeed=spinSpeed+0.7
  1207. if i%2==0 then PlaySound(assets.Minigun1,LeftGun,0.4+0.8*spinSpeed/40,1) end
  1208. wait()
  1209. end
  1210. local co=0
  1211. LeftGunSmoke.Enabled=true
  1212. local muzzleFlash = newPart(1,1,1,mech,nil,"Transparent","New Yeller")
  1213. newI{"SpecialMesh",muzzleFlash,MeshType="FileMesh",MeshId=assets.MuzzleFlash,Scale=V3(0.8,3,0.8)}
  1214. local muzzleW = newWeld(LeftGun,LeftGun,muzzleFlash,CF(0,0,0))
  1215. repeat
  1216. co=co+1
  1217. LeftGunW.C1=LeftGunW.C1*CFA(0,spinSpeed,0)
  1218. if co%2==0 then PlaySound(assets.Minigun1,LeftGun,1.2,1) end
  1219. if co%2==0 then
  1220. muzzleFlash.Transparency = 0.5
  1221. PlaySound(assets.Fire1,LeftGun,MRND(600,950)/1000,0.4)
  1222. local bullet = newI{"Part",mech,Name="Bullet",Anchored=true,CanCollide=false,formFactor="Custom",Size=V3(0.5,2,0.5),Debris=10,TopSurface='Smooth',BottomSurface='Smooth'}
  1223. newI{"CylinderMesh",bullet}
  1224. local rotRand = MRND(1,3)*120
  1225. bullet.CFrame=LeftGun.CFrame*CF(0,-6+2,0)*CFA(0,rotRand,0)*CF(0,0,-2+0.85)
  1226. addProjectile(bullet.Position,bullet.CFrame*CF(0,-1,0),800,function() print'boom' end,function(cf) bullet.CFrame=cf*CF(0,0,1)*CFA(90,0,0) end,function() bullet:Destroy() end)
  1227. muzzleW.C0 = CF(0,-6-2,0)*CFA(0,rotRand,0)*CF(0,0,-2+0.85)*CFA(180,0,0)
  1228. else
  1229. muzzleFlash.Transparency=1
  1230. end
  1231. wait()
  1232. until not Key.q
  1233. muzzleFlash:Destroy()
  1234. LeftGunSmoke.Enabled=false
  1235. LeftGunUse=false
  1236. for i=50,1,-0.5 do
  1237. if LeftGunUse then break end
  1238. if spinSpeed<0 then spinSpeed=0 end
  1239. LeftGunW.C1=LeftGunW.C1*CFA(0,spinSpeed,0)
  1240. spinSpeed=spinSpeed-0.35
  1241. if i%2==0 then PlaySound(assets.Minigun1,LeftGun,0.4+0.8*spinSpeed/40,1) end
  1242. wait()
  1243. end
  1244. elseif k=="]" then
  1245. Pilot = Char.Torso
  1246. Char.Humanoid.Sit = true
  1247. elseif k=="0" then
  1248. end
  1249. end
  1250. ------
  1251. onKeyUp = function(k)
  1252. if k=="a" and not Key.d then
  1253. Turn = 0
  1254. elseif k=="d" and not Key.a then
  1255. Turn = 0
  1256. end
  1257. end
  1258. ------
  1259. onButton1Down = function(k)
  1260. end
  1261. ------
  1262. onButton1Up = function(k)
  1263. end
  1264. ------
  1265. Mouse.KeyDown:connect(function(k)
  1266. Key[k]=true
  1267. onKeyDown(k)
  1268. end)
  1269. -------------------------
  1270. Mouse.KeyUp:connect(function(k)
  1271. Key[k]=false
  1272. onKeyUp(k)
  1273. end)
  1274. Mouse.Button1Down:connect(function()
  1275. Button1=true
  1276. onButton1Down()
  1277. end)
  1278. Mouse.Button1Up:connect(function()
  1279. Button1=false
  1280. onButton1Up()
  1281. end)
  1282.  
  1283. doAfter(1,function() Base.CanCollide=false end)
  1284. runcount = 0
  1285. game:getService'RunService'.Stepped:connect(function(aa,step)
  1286. runcount = runcount+1
  1287. --
  1288. if runcount%10==0 and AnimTorso and Movement and Pilot then
  1289. local y=GetY(Base,Mouse.Hit.p)
  1290. addAnim(Torso2W ,1,1,nil,{ 0, 0, 0, 0, -y, 0})
  1291. end
  1292. --
  1293. if AnimArms and Movement and Pilot then
  1294. local x=GetX(Torso2,Mouse.Hit.p)
  1295. if x>40 then x = 40 end
  1296. if x<-120 then x = -120 end
  1297. addAnim(LElbowW ,1,0.5,nil,{ nil, 0, nil, -120-x, 0, 0})
  1298. if x<-60 then x = -60 end
  1299. addAnim(RElbowW ,1,0.5,nil,{ nil, 0, nil, -120-x, 0, 0})
  1300. end
  1301. --
  1302. if runcount%5==0 and Turn~=0 and Movement and Pilot then
  1303. local turntarg = Base.CFrame*CFA(0,Turn,0)*CF(0,0,-1)
  1304. Gyro.cframe = CF(V3(Base.Position.x,0,Base.Position.z),V3(turntarg.x,0,turntarg.z))
  1305. end
  1306. --
  1307. if Key.w and not Key.s and Movement and Pilot and WalkDir==1 then
  1308. Velo.maxForce = V3(10000000,veloym,10000000)
  1309. local velo = Base.CFrame.lookVector*WalkingSpeed
  1310. Velo.Velocity = V3(velo.x,veloy,velo.z)
  1311. elseif Key.s and not Key.w and Movement and Pilot and WalkDir==-1 then
  1312. Velo.maxForce = V3(10000000,veloym,10000000)
  1313. local velo = Base.CFrame.lookVector*-12
  1314. Velo.Velocity = V3(velo.x,veloy,velo.z)
  1315. else
  1316. Velo.maxForce = V3(10000000,veloym,10000000)
  1317. Velo.Velocity = V3(0,veloy,0)
  1318. end
  1319. --
  1320. for i,anim in pairs(Anims) do
  1321. anim.Current = anim.Current + step
  1322. local CFStart = CF(anim.CFStart[1],anim.CFStart[2],anim.CFStart[3])*CFA(anim.CFStart[4],anim.CFStart[5],anim.CFStart[6])
  1323. local CFEnd = CF( anim.CFEnd[1], anim.CFEnd[2], anim.CFEnd[3])*CFA( anim.CFEnd[4], anim.CFEnd[5], anim.CFEnd[6])
  1324. anim.weld[anim.CC] = CFStart:lerp(CFEnd,anim.Current/anim.Time)
  1325. --print(anim.Current)
  1326. if anim.Current>=anim.Time then
  1327. anim.weld[anim.CC] = CFEnd -- 100%
  1328. Anims[i]=nil
  1329. end
  1330. end
  1331. --
  1332. for i,v in pairs(doAfterT) do
  1333. v.Current = v.Current + step
  1334. if v.Current>=v.Time then
  1335. v.Func()
  1336. doAfterT[i] = nil
  1337. end
  1338. end
  1339. --
  1340. for i,v in pairs(doInT) do
  1341. v.Current = v.Current + step
  1342. if v.Current>v.Time then v.Current = v.Time end -- sometimes exceeds
  1343. v.Func(v.Current/v.Time,i,step)
  1344. if doInT[i] and v.Current>=v.Time then
  1345. if v.FuncEnd then v.FuncEnd() end
  1346. doInT[i] = nil
  1347. end
  1348. end
  1349. --
  1350. end)
  1351. loadAnim:Open(0.2)
  1352. Anim = "Opened"
  1353. mech:MoveTo((CTorso.CFrame*CF(0,0,-30)).p)
  1354.  
  1355. --(CTorso.CFrame*CF(0,0,-16)).p)
  1356. -- hl/https://preview.c9users.io/jaspher/rbx_stoof/RMMech.lua
  1357. -- l/_G.m.addAnim(_G.m.BaseW ,1,1,nil,{ 0, 0, 0, 90, 0, 0})
  1358. -- l/_G.m.addAnim(_G.m.LThighW,1,1,nil,{1.5,0.5,0,-25,0,45})
  1359. -- l/_G.la:Open() l/_G.la:Standing()
  1360. -- c/for i,v in pairs(workspace.notrmdx["RM Mech 2"]:children()) do if v:IsA'BasePart' then v:SetNetworkOwner(game.Players.notrmdx) end end -- jew
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement