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