Advertisement
PixelDerpIsUber2

Untitled

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