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