View difference between Paste ID: V5XJc2TC and aspGXdBz
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
	local h,t
87
	--Give the server mouse data every second frame, but only if the values changed
88
	--If player is not moving their mouse, client won't fire events
89
	local HB = game:GetService("RunService").Heartbeat
90
	while true do
91
		if h~=Mouse.Hit or t~=Mouse.Target then
92
			h,t=Mouse.Hit,Mouse.Target
93
			Event:FireServer({isMouse=true,Target=t,Hit=h})
94
		end
95
		--Wait 2 frames
96
		for i=1,2 do
97
			HB:Wait()
98
		end
99
	end]==],script)
100
101
	----Sandboxed game object that allows the usage of client-side methods and services
102
	--Real game object
103
	local RealGame = game
104
105
	--Metatable for fake service
106
	local FakeService_Metatable = {
107
		__index = function(self,k)
108
			local s = rawget(self,"_RealService")
109
			if s then
110
				return typeof(s[k])=="function"
111
				and function(_,...)return s[k](s,...)end or s[k]
112
			end
113
		end,
114
		__newindex = function(self,k,v)
115
			local s = rawget(self,"_RealService")
116
			if s then s[k]=v end
117
		end
118
	}
119
	local function FakeService(t,RealService)
120
		t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
121
		return setmetatable(t,FakeService_Metatable)
122
	end
123
124
	--Fake game object
125
	local FakeGame = {
126
		GetService = function(self,s)
127
			return rawget(self,s) or RealGame:GetService(s)
128
		end,
129
		Players = FakeService({
130
			LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
131
		},"Players"),
132
		UserInputService = FakeService(UIS,"UserInputService"),
133
		ContextActionService = FakeService(CAS,"ContextActionService"),
134
		RunService = FakeService({
135
			_btrs = {},
136
			RenderStepped = RealGame:GetService("RunService").Heartbeat,
137
			BindToRenderStep = function(self,name,_,fun)
138
				self._btrs[name] = self.Heartbeat:Connect(fun)
139
			end,
140
			UnbindFromRenderStep = function(self,name)
141
				self._btrs[name]:Disconnect()
142
			end,
143
		},"RunService")
144
	}
145
	rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
146
	FakeGame.service = FakeGame.GetService
147
	FakeService(FakeGame,game)
148
	--Changing owner to fake player object to support owner:GetMouse()
149
	game,owner = FakeGame,FakeGame.Players.LocalPlayer
150
end
151
152
--bird wings Gifted by TXrangers222, Local Script!
153
--Jump Two Time
154
--Down Press Q
155
--Wings Spin Press A Two Time
156
--Wings Spin Press D Two Time
157
158
script.Parent = nil
159
160
function fly()
161
162
for i,v in pairs(script:GetChildren()) do
163
164
        pcall(function() v.Value = "" end)
165
166
        game:GetService("Debris"):AddItem(v,.1)
167
168
end
169
170
function weld(p0,p1,c0,c1,par)
171
172
        local w = Instance.new("Weld",p0 or par)
173
174
        w.Part0 = p0
175
176
        w.Part1 = p1
177
178
        w.C0 = c0 or CFrame.new()
179
180
        w.C1 = c1 or CFrame.new()
181
182
        return w
183
184
end
185
186
local motors = {}
187
188
function motor(p0,p1,c0,c1,des,vel,par)
189
190
        local w = Instance.new("Motor6D",p0 or par)
191
192
        w.Part0 = p0
193
194
        w.Part1 = p1
195
196
        w.C0 = c0 or CFrame.new()
197
198
        w.C1 = c1 or CFrame.new()
199
200
        w.MaxVelocity = tonumber(vel) or .05
201
202
        w.DesiredAngle = tonumber(des) or 0
203
204
        return w
205
206
end
207
208
function lerp(a,b,c)
209
210
    return a+(b-a)*c
211
212
end
213
214
function clerp(c1,c2,al)
215
216
        local com1 = {c1.X,c1.Y,c1.Z,c1:toEulerAnglesXYZ()}
217
218
        local com2 = {c2.X,c2.Y,c2.Z,c2:toEulerAnglesXYZ()}
219
220
        for i,v in pairs(com1) do
221
222
                com1[i] = lerp(v,com2[i],al)
223
224
        end
225
226
        return CFrame.new(com1[1],com1[2],com1[3]) * CFrame.Angles(select(4,unpack(com1)))
227
228
end
229
230
function ccomplerp(c1,c2,al)
231
232
        local com1 = {c1:components()}
233
234
        local com2 = {c2:components()}
235
236
        for i,v in pairs(com1) do
237
238
                com1[i] = lerp(v,com2[i],al)
239
240
        end
241
242
        return CFrame.new(unpack(com1))
243
244
end
245
246
function tickwave(time,length,offset)
247
248
        return (math.abs((tick()+(offset or 0))%time-time/2)*2-time/2)/time/2*length
249
250
end
251
252
function invcol(c)
253
254
        c = c.Color
255
256
        return BrickColor.new(Color3.new(1-c.b,1-c.g,1-c.r))
257
258
end
259
260
local oc = oc or function(...) return ... end
261
262
local plr = game.Players.LocalPlayer
263
264
local char = plr.Character
265
266
local tor = char.Torso
267
268
local hum = char.Humanoid
269
270
hum.PlatformStand = false
271
272
pcall(function()
273
274
        char.Wings:Destroy()
275
276
end)
277
278
pcall(function()
279
280
        char.Angel:Destroy() -- hat
281
282
end)
283
284
local mod = Instance.new("Model",char)
285
286
mod.Name = "Wings"
287
288
local special = {
289
290
        --antiboomz0r = {"Really black","Institutional white",0,0,false,Color3.new(1,1,.95),Color3.new(1,1,.6)},
291
292
        antiboomz0r = {"New Yeller",nil,0.4,0.7,true,Color3.new(1,1,.95),Color3.new(1,1,.6)},
293
294
        --antiboomz0r = {"Cyan","Toothpaste",0,0,false,Color3.new(1,0,0),Color3.new(0,0,0)},
295
296
        taart = {"Royal purple",nil,.4,.4,true},
297
298
        mitta = {"Black",nil,0,0,false},
299
300
        penjuin3 = {"White",nil,0,0,false},
301
302
        thepc8110 = {"Black","Bright red",.5,0,false,Color3.new(1,0,0),Color3.new(0,0,0)},
303
304
        nonspeaker = {"Cyan","Toothpaste",0,0,false,Color3.new(1,0,0),Color3.new(0,0,0)},
305
306
        littleau999 = {"Reddish brown",1030,0,0,false},
307
308
        unscripter = {"Really black","Really black",.2,0,true,Color3.new(0,0,0),Color3.new(0,0,0)},
309
310
        oxcool1 = {"Really black","White",.2,0,false,Color3.new(0,0,0),Color3.new(0,0,0)},
311
312
        krodmiss = {"Really black",nil,0,0,false},
313
314
}
315
316
local topcolor = invcol(char.Torso.BrickColor)
317
318
local feacolor = char.Torso.BrickColor
319
320
local ptrans = 0
321
322
local pref = 0
323
324
local fire = false
325
326
local fmcol = Color3.new()
327
328
local fscol = Color3.new()
329
330
local spec = special[plr.Name:lower()]
331
332
if spec then
333
334
        topcolor,feacolor,ptrans,pref,fire,fmcol,fscol = spec[1] and BrickColor.new(spec[1]) or topcolor,spec[2] and BrickColor.new(spec[2]) or feacolor,spec[3],spec[4],spec[5],spec[6],spec[7]
335
336
end
337
338
local part = Instance.new("Part")
339
340
part.FormFactor = "Custom"
341
342
part.Size = Vector3.new(.2,.2,.2)
343
344
part.TopSurface,part.BottomSurface = 0,0
345
346
part.CanCollide = false
347
348
part.BrickColor = topcolor
349
350
part.Transparency = ptrans
351
352
part.Reflectance = pref
353
354
local ef = Instance.new("Fire",fire and part or nil)
355
356
ef.Size = .15
357
358
ef.Color = fmcol or Color3.new()
359
360
ef.SecondaryColor = fscol or Color3.new()
361
362
part:BreakJoints()
363
364
365
function newpart()
366
367
        local clone = part:Clone()
368
369
        clone.Parent = mod
370
371
        clone:BreakJoints()
372
373
        return clone
374
375
end
376
377
local feath = newpart()
378
379
feath.BrickColor = feacolor
380
381
feath.Transparency = 0
382
383
Instance.new("SpecialMesh",feath).MeshType = "Sphere"
384
385
function newfeather()
386
387
        local clone = feath:Clone()
388
389
        clone.Parent = mod
390
391
        clone:BreakJoints()
392
393
        return clone
394
395
end
396
397
398
---------- RIGHT WING
399
400
local r1 = newpart()
401
402
r1.Size = Vector3.new(.3,1.5,.3)*1.2
403
404
local rm1 = motor(tor,r1,CFrame.new(.35,.6,.4) * CFrame.Angles(0,0,math.rad(-60)) * CFrame.Angles(math.rad(30),math.rad(-25),0),CFrame.new(0,-.8,0),.1)
405
406
local r2 = newpart()
407
408
r2.Size = Vector3.new(.4,1.8,.4)*1.2
409
410
local rm2 = motor(r1,r2,CFrame.new(0,.75,0) * CFrame.Angles(0,0,math.rad(50)) * CFrame.Angles(math.rad(-30),math.rad(15),0),CFrame.new(0,-.9,0),.1)
411
412
local r3 = newpart()
413
414
r3.Size = Vector3.new(.3,2.2,.3)*1.2
415
416
local rm3 = motor(r2,r3,CFrame.new(.1,.9,0) * CFrame.Angles(0,0,math.rad(-140)) * CFrame.Angles(math.rad(-3),0,0),CFrame.new(0,-1.1,0),.1)
417
418
local r4 = newpart()
419
420
r4.Size = Vector3.new(.25,1.2,.25)*1.2
421
422
local rm4 = motor(r3,r4,CFrame.new(0,1.1,0) * CFrame.Angles(0,0,math.rad(-10)) * CFrame.Angles(math.rad(-3),0,0),CFrame.new(0,-.6,0),.1)
423
424
local feather = newfeather()
425
426
feather.Mesh.Scale = Vector3.new(1,1,1)
427
428
feather.Size = Vector3.new(.4,3,.3)
429
430
weld(r4,feather,CFrame.new(-.1,-.3,0),CFrame.new(0,-1.5,0))
431
432
feather = newfeather()
433
434
feather.Mesh.Scale = Vector3.new(1,1,1)
435
436
feather.Size = Vector3.new(.4,2.3,.3)
437
438
weld(r4,feather,CFrame.new(.1,-.1,0) * CFrame.Angles(0,math.random()*.1,0),CFrame.new(0,-1.1,0))
439
440
feather = newfeather()
441
442
feather.Mesh.Scale = Vector3.new(1,1,1)
443
444
feather.Size = Vector3.new(.35,2.2,.25)
445
446
weld(r4,feather,CFrame.new(.1,-.3,0) * CFrame.Angles(0,math.random()*.1,math.rad(-10)),CFrame.new(0,-1.1,0))
447
448
local rf3 = {}
449
450
for i=0,7 do
451
452
        feather = newfeather()
453
454
        feather.Mesh.Scale = Vector3.new(1,1,1)
455
456
        feather.Size = Vector3.new(.45,2.2,.35)
457
458
        table.insert(rf3,motor(r3,feather,CFrame.new(.05,1-i*.285,0) * CFrame.Angles(0,math.random()*.1,math.rad(-25-i*2)),CFrame.new(0,-feather.Size.Y/2,0)))
459
460
end
461
462
local rf2 = {}
463
464
for i=0,6 do
465
466
        feather = newfeather()
467
468
        feather.Mesh.Scale = Vector3.new(1,1,1)
469
470
        feather.Size = Vector3.new(.45,2.2-i*.08,.3)
471
472
        table.insert(rf2,motor(r2,feather,CFrame.new(.05,.75-i*.26,0) * CFrame.Angles(0,math.random()*.1,math.rad(-75-i*4)),CFrame.new(0,-feather.Size.Y/2,0)))
473
474
end
475
476
local rf1 = {}
477
478
for i=0,6 do
479
480
        feather = newfeather()
481
482
        feather.Mesh.Scale = Vector3.new(1,1,1)
483
484
        feather.Size = Vector3.new(.37,1.65-i*.06,.25)
485
486
        table.insert(rf1,motor(r1,feather,CFrame.new(.05,.63-i*.21,0) * CFrame.Angles(0,math.random()*.05,math.rad(-75)),CFrame.new(0,-feather.Size.Y/2,0)))
487
488
end
489
490
---------- LEFT WING
491
492
local l1 = newpart()
493
494
l1.Size = Vector3.new(.3,1.5,.3)*1.2
495
496
local lm1 = motor(tor,l1,CFrame.new(-.35,.6,.4) * CFrame.Angles(0,0,math.rad(60)) * CFrame.Angles(math.rad(30),math.rad(25),0) * CFrame.Angles(0,-math.pi,0),CFrame.new(0,-.8,0) ,.1)
497
498
local l2 = newpart()
499
500
l2.Size = Vector3.new(.4,1.8,.4)*1.2
501
502
local lm2 = motor(l1,l2,CFrame.new(0,.75,0) * CFrame.Angles(0,0,math.rad(50)) * CFrame.Angles(math.rad(30),math.rad(-15),0),CFrame.new(0,-.9,0),.1)
503
504
local l3 = newpart()
505
506
l3.Size = Vector3.new(.3,2.2,.3)*1.2
507
508
local lm3 = motor(l2,l3,CFrame.new(.1,.9,0) * CFrame.Angles(0,0,math.rad(-140)) * CFrame.Angles(math.rad(3),0,0),CFrame.new(0,-1.1,0),.1)
509
510
local l4 = newpart()
511
512
l4.Size = Vector3.new(.25,1.2,.25)*1.2
513
514
local lm4 = motor(l3,l4,CFrame.new(0,1.1,0) * CFrame.Angles(0,0,math.rad(-10)) * CFrame.Angles(math.rad(3),0,0),CFrame.new(0,-.6,0),.1)
515
516
local feather = newfeather()
517
518
feather.Mesh.Scale = Vector3.new(1,1,1)
519
520
feather.Size = Vector3.new(.4,3,.3)
521
522
weld(l4,feather,CFrame.new(-.1,-.3,0),CFrame.new(0,-1.5,0))
523
524
feather = newfeather()
525
526
feather.Mesh.Scale = Vector3.new(1,1,1)
527
528
feather.Size = Vector3.new(.4,2.3,.3)
529
530
weld(l4,feather,CFrame.new(.1,-.1,0) * CFrame.Angles(0,math.random()*.1,0),CFrame.new(0,-1.1,0))
531
532
feather = newfeather()
533
534
feather.Mesh.Scale = Vector3.new(1,1,1)
535
536
feather.Size = Vector3.new(.35,2.2,.25)
537
538
weld(l4,feather,CFrame.new(.1,-.3,0) * CFrame.Angles(0,math.random()*.1,math.rad(-10)),CFrame.new(0,-1.1,0))
539
540
local lf3 = {}
541
542
for i=0,7 do
543
544
        feather = newfeather()
545
546
        feather.Mesh.Scale = Vector3.new(1,1,1)
547
548
        feather.Size = Vector3.new(.45,2.2,.35)
549
550
        table.insert(lf3,motor(l3,feather,CFrame.new(.05,1-i*.285,0) * CFrame.Angles(0,math.random()*.1,math.rad(-25-i*2)),CFrame.new(0,-feather.Size.Y/2,0)))
551
552
end
553
554
local lf2 = {}
555
556
for i=0,6 do
557
558
        feather = newfeather()
559
560
        feather.Mesh.Scale = Vector3.new(1,1,1)
561
562
        feather.Size = Vector3.new(.45,2.2-i*.08,.3)
563
564
        table.insert(lf2,motor(l2,feather,CFrame.new(.05,.75-i*.26,0) * CFrame.Angles(0,math.random()*.1,math.rad(-75-i*4)),CFrame.new(0,-feather.Size.Y/2,0)))
565
566
end
567
568
local lf1 = {}
569
570
for i=0,6 do
571
572
        feather = newfeather()
573
574
        feather.Mesh.Scale = Vector3.new(1,1,1)
575
576
        feather.Size = Vector3.new(.37,1.65-i*.06,.25)
577
578
        table.insert(lf1,motor(l1,feather,CFrame.new(.05,.63-i*.21,0) * CFrame.Angles(0,math.random()*.05,math.rad(-75)),CFrame.new(0,-feather.Size.Y/2,0)))
579
580
end
581
582
local rwing = {rm1,rm2,rm3,rm4}
583
584
local lwing = {lm1,lm2,lm3,lm4}
585
586
local oc0 = {}
587
588
for i,v in pairs(rwing) do
589
590
        oc0[v] = v.C0
591
592
end
593
594
for i,v in pairs(lwing) do
595
596
        oc0[v] = v.C0
597
598
end
599
600
function gotResized()
601
602
        if lastsize then
603
604
                if tor.Size == lastsize then return end -- This shouldn't happen?
605
606
                local scaleVec = tor.Size/lastsize
607
608
                for i,v in pairs(oc0) do
609
610
                        oc0[i] = v-v.p+scaleVec*v.p
611
612
                end
613
614
                lastsize = tor.Size
615
616
        end
617
618
        lastsize = tor.Size
619
620
end
621
622
tor.Changed:connect(function(p)
623
624
        if p == "Size" then
625
626
                gotResized()
627
628
        end
629
630
end)
631
632
gotResized()
633
634
local idle = {0,0.5,-.2,0; .05,.05,.1,.05; -.6,-1.5,.1,0;}--0,.3,0,0
635
636
local outlow = {-.7,-.2,1.8,0; .3,.05,.1,.05; .2,0,0,0}
637
638
local outhigh = {.5,-.2,1.8,0; .3,.05,.1,.05; .2,0,0,0}
639
640
local veryhigh = {.9,-.3,1.9,0; .3,.05,.1,.05; .2,0,0,0}
641
642
local flap1 = {-.3,.3,1.1,-.2; .3,.05,.1,.05; .2,-.6,0,0}
643
644
local divebomb = {0,.2,.4,-.7; .3,.05,.1,.05; 0,-.5,-.6,0}
645
646
647
function setwings(tab,time)
648
649
        time = time or 10
650
651
        for i=1,4 do
652
653
                rwing[i].DesiredAngle = tab[i]
654
655
                lwing[i].DesiredAngle = tab[i]
656
657
                rwing[i].MaxVelocity = math.abs(tab[i]-rwing[i].CurrentAngle)/time
658
659
                lwing[i].MaxVelocity = math.abs(tab[i]-lwing[i].CurrentAngle)/time
660
661
                local rcf = oc0[rwing[i]] * (tab[12+i] or CFrame.new())
662
663
                local lcf = oc0[lwing[i]] * (tab[12+i] or CFrame.new())
664
665
        end
666
667
        for i,v in pairs(rf1) do
668
669
                v.DesiredAngle = tab[9]
670
671
                v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time
672
673
        end
674
675
        for i,v in pairs(lf1) do
676
677
                v.DesiredAngle = tab[9]
678
679
                v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time
680
681
        end
682
683
        for i,v in pairs(rf2) do
684
685
                v.DesiredAngle = tab[10]
686
687
                v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time
688
689
        end
690
691
        for i,v in pairs(lf2) do
692
693
                v.DesiredAngle = tab[10]
694
695
                v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time
696
697
        end
698
699
        for i,v in pairs(rf3) do
700
701
                v.DesiredAngle = tab[11]
702
703
                v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time
704
705
        end
706
707
        for i,v in pairs(lf3) do
708
709
                v.DesiredAngle = tab[11]
710
711
                v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time
712
713
        end
714
715
end
716
717
setwings(outhigh,1)
718
719
flying = false
720
721
moving = false
722
723
for i,v in pairs(tor:GetChildren()) do
724
725
        if v.ClassName:lower():match("body") then
726
727
                v:Destroy()
728
729
        end
730
731
end
732
733
local ctor = tor:Clone()
734
735
ctor:ClearAllChildren()
736
737
ctor.Name = "cTorso"
738
739
ctor.Transparency = 1
740
741
ctor.CanCollide = false
742
743
ctor.FormFactor = "Custom"
744
745
ctor.Size = Vector3.new(.2,.2,.2)
746
747
ctor.Parent = mod
748
749
weld(tor,ctor)
750
751
local bg = Instance.new("BodyGyro",ctor)
752
753
bg.maxTorque = Vector3.new()
754
755
bg.P = 15000
756
757
bg.D = 1000
758
759
local bv = Instance.new("BodyVelocity",ctor)
760
761
bv.maxForce = Vector3.new()
762
763
bv.P = 15000
764
765
vel = Vector3.new()
766
767
cf = CFrame.new()
768
769
flspd = 0
770
771
772
keysdown = {}
773
774
keypressed = {}
775
776
ktime = {}
777
778
descendtimer = 0
779
780
jumptime = tick()
781
782
hum.Jumping:connect(function()
783
784
        jumptime = tick()
785
786
end)
787
788
cam = workspace.CurrentCamera
789
790
kd = plr:GetMouse().KeyDown:connect(oc(function(key) 
791
792
        keysdown[key] = true 
793
794
        keypressed[key] = true 
795
796
        if key == "q" then 
797
798
                descendtimer = tick() 
799
800
        elseif key == " " and not hum.Jump then 
801
802
                jumptime = tick()
803
804
        elseif (key == "a" or key == "d") and ktime[key] and tick()-ktime[key] < .3 and math.abs(reqrotx) < .3 then
805
806
                reqrotx = key == "a" and math.pi*2 or -math.pi*2
807
808
        end
809
810
        ktime[key] = tick() 
811
812
end))
813
814
ku = plr:GetMouse().KeyUp:connect(function(key) 
815
816
        keysdown[key] = false 
817
818
        if key == " " then 
819
820
                descendtimer = tick() 
821
822
        end 
823
824
end)
825
826
function mid(a,b,c)
827
828
        return math.max(a,math.min(b,c or -a))
829
830
end
831
832
function bn(a)
833
834
        return a and 1 or 0
835
836
end
837
838
function gm(tar)
839
840
        local m = 0
841
842
        for i,v in pairs(tar:GetChildren()) do
843
844
                if v:IsA("BasePart") then
845
846
                        m = m + v:GetMass()
847
848
                end
849
850
                        m = m + gm(v)
851
852
        end
853
854
        return m
855
856
end
857
858
reqrotx = 0
859
860
local grav = 196.2
861
862
local con
863
864
con = game:GetService("RunService").Stepped:connect(oc(function()
865
866
        --[[if not mod:IsDescendantOf(workspace) then
867
868
                pcall(function() kd:disconnect() end)
869
870
                pcall(function() ku:disconnect() end)
871
872
                bg:Destroy()
873
874
                bv:Destroy()
875
876
                con:disconnect()
877
878
                script:Destroy()
879
880
                return
881
882
        end]]
883
884
        local obvel = tor.CFrame:vectorToObjectSpace(tor.Velocity)
885
886
        local sspd, uspd,fspd = obvel.X,obvel.Y,obvel.Z
887
888
        if flying then
889
890
                local lfldir = fldir
891
892
                fldir = cam.CoordinateFrame:vectorToWorldSpace(Vector3.new(bn(keysdown.d)-bn(keysdown.a),0,bn(keysdown.s)-bn(keysdown.w))).unit
893
894
                local lmoving = moving
895
896
                moving = fldir.magnitude > .1
897
898
                if lmoving and not moving then
899
900
                        idledir = lfldir*Vector3.new(1,0,1)
901
902
                        descendtimer = tick()
903
904
                end
905
906
                local dbomb = fldir.Y < -.6 or (moving and keysdown["1"])
907
908
                if moving and keysdown["0"] and lmoving then
909
910
                        fldir = (Vector3.new(lfldir.X,math.min(fldir.Y,lfldir.Y+.01)-.1,lfldir.Z)+(fldir*Vector3.new(1,0,1))*.05).unit
911
912
                end
913
914
                local down = tor.CFrame:vectorToWorldSpace(Vector3.new(0,-1,0))
915
916
                local descending = (not moving and keysdown["q"] and not keysdown[" "])
917
918
                cf = ccomplerp(cf,CFrame.new(tor.Position,tor.Position+(not moving and idledir or fldir)),keysdown["0"] and .02 or .07)
919
920
                local gdown = not dbomb and cf.lookVector.Y < -.2 and tor.Velocity.unit.Y < .05
921
922
                hum.PlatformStand = true
923
924
                bg.maxTorque = Vector3.new(1,1,1)*9e5
925
926
                local rotvel = CFrame.new(Vector3.new(),tor.Velocity):toObjectSpace(CFrame.new(Vector3.new(),fldir)).lookVector
927
928
                bg.cframe = cf * CFrame.Angles(not moving and -.1 or -math.pi/2+.2,moving and mid(-2.5,rotvel.X/1.5) + reqrotx or 0,0)
929
930
                reqrotx = reqrotx - reqrotx/10
931
932
                bv.maxForce = Vector3.new(1,1,1)*9e4*.5
933
934
                local anioff =(bn(keysdown[" "])-bn(keysdown["q"]))/2
935
936
                local ani = tickwave(1.5-anioff,1)
937
938
                bv.velocity = bv.velocity:Lerp(Vector3.new(0,bn(not moving)*-ani*15+(descending and math.min(20,tick()-descendtimer)*-8 or bn(keysdown[" "])-bn(keysdown["q"]))*15,0)+vel,.6) 
939
940
                vel = moving and cf.lookVector*flspd or Vector3.new()
941
942
                flspd = math.min(120,lerp(flspd,moving and (fldir.Y<0 and flspd+(-fldir.Y)*grav/60 or math.max(50,flspd-fldir.Y*grav/300)) or 60,.4))
943
944
                setwings(moving and (gdown and outlow or dbomb and divebomb) or (descending and veryhigh or flap1),15)
945
946
                for i=1,4 do
947
948
                        --CFrame.Angles(-.5+bn(i==3)*2.4+bn(i==4)*.5,.1+bn(i==2)*.5-bn(i==3)*1.1,bn(i==3)*.1)
949
950
                        rwing[i].C0 = clerp(rwing[i].C0,oc0[rwing[i]] * (gdown and CFrame.new() or dbomb and CFrame.Angles(-.5+bn(i==3)*.4+bn(i==4)*.5,.1+bn(i==2)*.5-bn(i==3)*1.1,bn(i==3)*.1) or descending and CFrame.Angles(.3,0,0) or CFrame.Angles((i*.1+1.5)*ani,ani*-.5,1*ani)),descending and .8 or .2)
951
952
                        lwing[i].C0 = clerp(lwing[i].C0,oc0[lwing[i]] * (gdown and CFrame.new() or dbomb and CFrame.Angles(-(-.5+bn(i==3)*.4+bn(i==4)*.5),-(.1+bn(i==2)*.5-bn(i==3)*1.1),bn(i==3)*.1) or descending and CFrame.Angles(-.3,0,0) or CFrame.Angles(-(i*.1+1.5)*ani,ani*.5,1*ani)),descending and .8 or .2)
953
954
                end
955
956
                local hit,ray = workspace:FindPartOnRayWithIgnoreList(Ray.new(tor.Position,Vector3.new(0,-3.5+math.min(0,bv.velocity.y)/30,0)),{char})
957
958
                if hit and down.Y < -.85 and tick()-flystart > 1 then
959
960
                        flying = false
961
962
                        hum.PlatformStand = false
963
964
                        tor.Velocity = Vector3.new()
965
966
                end
967
968
        else
969
970
                bg.maxTorque = Vector3.new()
971
972
                bv.maxForce = Vector3.new()
973
974
                local ani = tickwave(walking and .8 or 4.5,1)
975
976
                setwings(idle,10)
977
978
                local x,y,z = fspd/160,uspd/700,sspd/900
979
980
                for i=1,4 do
981
982
                        rwing[i].C0 = clerp(rwing[i].C0,oc0[rwing[i]] * CFrame.Angles(ani*.1 + -mid(-.1,x),0 + -mid(-.1,y) + bn(i==2)*.6,ani*.02 + -mid(-.1,z)),.2)
983
984
                        lwing[i].C0 = clerp(lwing[i].C0,oc0[lwing[i]] * CFrame.Angles(ani*-.05 + mid(-.1,x),0 + mid(-.1,y) + -bn(i==2)*.6,ani*.02 + mid(-.1,z)),.2)
985
986
                end
987
988
                if keypressed[" "] and not flying and (tick()-jumptime > .05 and (tick()-jumptime < 3 or hum.Jump)) then
989
990
                        vel = Vector3.new(0,50,0)
991
992
                        bv.velocity = vel
993
994
                        idledir = cam.CoordinateFrame.lookVector*Vector3.new(1,0,1)
995
996
                        cf = tor.CFrame * CFrame.Angles(-.01,0,0)
997
998
                        tor.CFrame = cf
999
1000
                        bg.cframe = cf
1001
1002
                        flystart = tick()
1003
1004
                        flying = true
1005
1006
                end
1007
1008
        end
1009
1010
        keypressed = {}
1011
1012
end))
1013
1014
1015
1016
end fly()
1017
1018
--Bird Wings By TXrangers222