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