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