SHOW:
|
|
- or go back to the newest paste.
1 | - | --bird wings Gifted by harrypotterfan249, Local Script! |
1 | + | --bird wings by smokedelsin |
2 | - | --Jump Two Time |
2 | + | |
3 | - | --Down Press Q |
3 | + | |
4 | function fly() | |
5 | ||
6 | for i,v in pairs(script:GetChildren()) do | |
7 | ||
8 | pcall(function() v.Value = "" end) | |
9 | ||
10 | game:GetService("Debris"):AddItem(v,.1) | |
11 | ||
12 | end | |
13 | ||
14 | function weld(p0,p1,c0,c1,par) | |
15 | ||
16 | local w = Instance.new("Weld",p0 or par) | |
17 | ||
18 | w.Part0 = p0 | |
19 | ||
20 | w.Part1 = p1 | |
21 | ||
22 | w.C0 = c0 or CFrame.new() | |
23 | ||
24 | w.C1 = c1 or CFrame.new() | |
25 | ||
26 | return w | |
27 | ||
28 | end | |
29 | ||
30 | local motors = {} | |
31 | ||
32 | function motor(p0,p1,c0,c1,des,vel,par) | |
33 | ||
34 | local w = Instance.new("Motor6D",p0 or par) | |
35 | ||
36 | w.Part0 = p0 | |
37 | ||
38 | w.Part1 = p1 | |
39 | ||
40 | w.C0 = c0 or CFrame.new() | |
41 | ||
42 | w.C1 = c1 or CFrame.new() | |
43 | ||
44 | w.MaxVelocity = tonumber(vel) or .05 | |
45 | ||
46 | w.DesiredAngle = tonumber(des) or 0 | |
47 | ||
48 | return w | |
49 | ||
50 | end | |
51 | ||
52 | function lerp(a,b,c) | |
53 | ||
54 | return a+(b-a)*c | |
55 | ||
56 | end | |
57 | ||
58 | function clerp(c1,c2,al) | |
59 | ||
60 | local com1 = {c1.X,c1.Y,c1.Z,c1:toEulerAnglesXYZ()} | |
61 | ||
62 | local com2 = {c2.X,c2.Y,c2.Z,c2:toEulerAnglesXYZ()} | |
63 | ||
64 | for i,v in pairs(com1) do | |
65 | ||
66 | com1[i] = lerp(v,com2[i],al) | |
67 | ||
68 | end | |
69 | ||
70 | return CFrame.new(com1[1],com1[2],com1[3]) * CFrame.Angles(select(4,unpack(com1))) | |
71 | ||
72 | end | |
73 | ||
74 | function ccomplerp(c1,c2,al) | |
75 | ||
76 | local com1 = {c1:components()} | |
77 | ||
78 | local com2 = {c2:components()} | |
79 | ||
80 | for i,v in pairs(com1) do | |
81 | ||
82 | com1[i] = lerp(v,com2[i],al) | |
83 | ||
84 | end | |
85 | ||
86 | return CFrame.new(unpack(com1)) | |
87 | ||
88 | end | |
89 | ||
90 | function tickwave(time,length,offset) | |
91 | ||
92 | return (math.abs((tick()+(offset or 0))%time-time/2)*2-time/2)/time/2*length | |
93 | ||
94 | end | |
95 | ||
96 | function invcol(c) | |
97 | ||
98 | c = c.Color | |
99 | ||
100 | return BrickColor.new(Color3.new(1-c.b,1-c.g,1-c.r)) | |
101 | ||
102 | end | |
103 | ||
104 | local oc = oc or function(...) return ... end | |
105 | ||
106 | local plr = game.Players.LocalPlayer | |
107 | ||
108 | local char = plr.Character | |
109 | ||
110 | local tor = char.Torso | |
111 | ||
112 | local hum = char.Humanoid | |
113 | ||
114 | hum.PlatformStand = false | |
115 | ||
116 | pcall(function() | |
117 | ||
118 | char.Wings:Destroy() | |
119 | ||
120 | end) | |
121 | ||
122 | pcall(function() | |
123 | ||
124 | char.Angel:Destroy() -- hat | |
125 | ||
126 | end) | |
127 | ||
128 | local mod = Instance.new("Model",char) | |
129 | ||
130 | mod.Name = "Wings" | |
131 | ||
132 | local special = { | |
133 | ||
134 | --antiboomz0r = {"Really black","Institutional white",0,0,false,Color3.new(1,1,.95),Color3.new(1,1,.6)}, | |
135 | ||
136 | antiboomz0r = {"New Yeller",nil,0.4,0.7,true,Color3.new(1,1,.95),Color3.new(1,1,.6)}, | |
137 | ||
138 | --antiboomz0r = {"Cyan","Toothpaste",0,0,false,Color3.new(1,0,0),Color3.new(0,0,0)}, | |
139 | ||
140 | taart = {"Royal purple",nil,.4,.4,true}, | |
141 | ||
142 | mitta = {"Black",nil,0,0,false}, | |
143 | ||
144 | penjuin3 = {"White",nil,0,0,false}, | |
145 | ||
146 | thepc8110 = {"Black","Bright red",.5,0,false,Color3.new(1,0,0),Color3.new(0,0,0)}, | |
147 | ||
148 | nonspeaker = {"Cyan","Toothpaste",0,0,false,Color3.new(1,0,0),Color3.new(0,0,0)}, | |
149 | ||
150 | littleau999 = {"Reddish brown",1030,0,0,false}, | |
151 | ||
152 | unscripter = {"Really black","Really black",.2,0,true,Color3.new(0,0,0),Color3.new(0,0,0)}, | |
153 | ||
154 | oxcool1 = {"Really black","White",.2,0,false,Color3.new(0,0,0),Color3.new(0,0,0)}, | |
155 | ||
156 | krodmiss = {"Really black",nil,0,0,false}, | |
157 | ||
158 | } | |
159 | ||
160 | local topcolor = invcol(char.Torso.BrickColor) | |
161 | ||
162 | local feacolor = char.Torso.BrickColor | |
163 | ||
164 | local ptrans = 0 | |
165 | ||
166 | local pref = 0 | |
167 | ||
168 | local fire = false | |
169 | ||
170 | local fmcol = Color3.new() | |
171 | ||
172 | local fscol = Color3.new() | |
173 | ||
174 | local spec = special[plr.Name:lower()] | |
175 | ||
176 | if spec then | |
177 | ||
178 | 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] | |
179 | ||
180 | end | |
181 | ||
182 | local part = Instance.new("Part") | |
183 | ||
184 | part.FormFactor = "Custom" | |
185 | ||
186 | part.Size = Vector3.new(.2,.2,.2) | |
187 | ||
188 | part.TopSurface,part.BottomSurface = 0,0 | |
189 | ||
190 | part.CanCollide = false | |
191 | ||
192 | part.BrickColor = topcolor | |
193 | ||
194 | part.Transparency = ptrans | |
195 | ||
196 | part.Reflectance = pref | |
197 | ||
198 | local ef = Instance.new("Fire",fire and part or nil) | |
199 | ||
200 | ef.Size = .15 | |
201 | ||
202 | ef.Color = fmcol or Color3.new() | |
203 | ||
204 | ef.SecondaryColor = fscol or Color3.new() | |
205 | ||
206 | part:BreakJoints() | |
207 | ||
208 | ||
209 | function newpart() | |
210 | ||
211 | local clone = part:Clone() | |
212 | ||
213 | clone.Parent = mod | |
214 | ||
215 | clone:BreakJoints() | |
216 | ||
217 | return clone | |
218 | ||
219 | end | |
220 | ||
221 | local feath = newpart() | |
222 | ||
223 | feath.BrickColor = feacolor | |
224 | ||
225 | feath.Transparency = 0 | |
226 | ||
227 | Instance.new("SpecialMesh",feath).MeshType = "Sphere" | |
228 | ||
229 | function newfeather() | |
230 | ||
231 | local clone = feath:Clone() | |
232 | ||
233 | clone.Parent = mod | |
234 | ||
235 | clone:BreakJoints() | |
236 | ||
237 | return clone | |
238 | ||
239 | end | |
240 | ||
241 | ||
242 | ---------- RIGHT WING | |
243 | ||
244 | local r1 = newpart() | |
245 | ||
246 | r1.Size = Vector3.new(.3,1.5,.3)*1.2 | |
247 | ||
248 | 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) | |
249 | ||
250 | local r2 = newpart() | |
251 | ||
252 | r2.Size = Vector3.new(.4,1.8,.4)*1.2 | |
253 | ||
254 | 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) | |
255 | ||
256 | local r3 = newpart() | |
257 | ||
258 | r3.Size = Vector3.new(.3,2.2,.3)*1.2 | |
259 | ||
260 | 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) | |
261 | ||
262 | local r4 = newpart() | |
263 | ||
264 | r4.Size = Vector3.new(.25,1.2,.25)*1.2 | |
265 | ||
266 | 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) | |
267 | ||
268 | local feather = newfeather() | |
269 | ||
270 | feather.Mesh.Scale = Vector3.new(1,1,1) | |
271 | ||
272 | feather.Size = Vector3.new(.4,3,.3) | |
273 | ||
274 | weld(r4,feather,CFrame.new(-.1,-.3,0),CFrame.new(0,-1.5,0)) | |
275 | ||
276 | feather = newfeather() | |
277 | ||
278 | feather.Mesh.Scale = Vector3.new(1,1,1) | |
279 | ||
280 | feather.Size = Vector3.new(.4,2.3,.3) | |
281 | ||
282 | weld(r4,feather,CFrame.new(.1,-.1,0) * CFrame.Angles(0,math.random()*.1,0),CFrame.new(0,-1.1,0)) | |
283 | ||
284 | feather = newfeather() | |
285 | ||
286 | feather.Mesh.Scale = Vector3.new(1,1,1) | |
287 | ||
288 | feather.Size = Vector3.new(.35,2.2,.25) | |
289 | ||
290 | weld(r4,feather,CFrame.new(.1,-.3,0) * CFrame.Angles(0,math.random()*.1,math.rad(-10)),CFrame.new(0,-1.1,0)) | |
291 | ||
292 | local rf3 = {} | |
293 | ||
294 | for i=0,7 do | |
295 | ||
296 | feather = newfeather() | |
297 | ||
298 | feather.Mesh.Scale = Vector3.new(1,1,1) | |
299 | ||
300 | feather.Size = Vector3.new(.45,2.2,.35) | |
301 | ||
302 | 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))) | |
303 | ||
304 | end | |
305 | ||
306 | local rf2 = {} | |
307 | ||
308 | for i=0,6 do | |
309 | ||
310 | feather = newfeather() | |
311 | ||
312 | feather.Mesh.Scale = Vector3.new(1,1,1) | |
313 | ||
314 | feather.Size = Vector3.new(.45,2.2-i*.08,.3) | |
315 | ||
316 | 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))) | |
317 | ||
318 | end | |
319 | ||
320 | local rf1 = {} | |
321 | ||
322 | for i=0,6 do | |
323 | ||
324 | feather = newfeather() | |
325 | ||
326 | feather.Mesh.Scale = Vector3.new(1,1,1) | |
327 | ||
328 | feather.Size = Vector3.new(.37,1.65-i*.06,.25) | |
329 | ||
330 | 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))) | |
331 | ||
332 | end | |
333 | ||
334 | ---------- LEFT WING | |
335 | ||
336 | local l1 = newpart() | |
337 | ||
338 | l1.Size = Vector3.new(.3,1.5,.3)*1.2 | |
339 | ||
340 | 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) | |
341 | ||
342 | local l2 = newpart() | |
343 | ||
344 | l2.Size = Vector3.new(.4,1.8,.4)*1.2 | |
345 | ||
346 | 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) | |
347 | ||
348 | local l3 = newpart() | |
349 | ||
350 | l3.Size = Vector3.new(.3,2.2,.3)*1.2 | |
351 | ||
352 | 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) | |
353 | ||
354 | local l4 = newpart() | |
355 | ||
356 | l4.Size = Vector3.new(.25,1.2,.25)*1.2 | |
357 | ||
358 | 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) | |
359 | ||
360 | local feather = newfeather() | |
361 | ||
362 | feather.Mesh.Scale = Vector3.new(1,1,1) | |
363 | ||
364 | feather.Size = Vector3.new(.4,3,.3) | |
365 | ||
366 | weld(l4,feather,CFrame.new(-.1,-.3,0),CFrame.new(0,-1.5,0)) | |
367 | ||
368 | feather = newfeather() | |
369 | ||
370 | feather.Mesh.Scale = Vector3.new(1,1,1) | |
371 | ||
372 | feather.Size = Vector3.new(.4,2.3,.3) | |
373 | ||
374 | weld(l4,feather,CFrame.new(.1,-.1,0) * CFrame.Angles(0,math.random()*.1,0),CFrame.new(0,-1.1,0)) | |
375 | ||
376 | feather = newfeather() | |
377 | ||
378 | feather.Mesh.Scale = Vector3.new(1,1,1) | |
379 | ||
380 | feather.Size = Vector3.new(.35,2.2,.25) | |
381 | ||
382 | weld(l4,feather,CFrame.new(.1,-.3,0) * CFrame.Angles(0,math.random()*.1,math.rad(-10)),CFrame.new(0,-1.1,0)) | |
383 | ||
384 | local lf3 = {} | |
385 | ||
386 | for i=0,7 do | |
387 | ||
388 | feather = newfeather() | |
389 | ||
390 | feather.Mesh.Scale = Vector3.new(1,1,1) | |
391 | ||
392 | feather.Size = Vector3.new(.45,2.2,.35) | |
393 | ||
394 | 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))) | |
395 | ||
396 | end | |
397 | ||
398 | local lf2 = {} | |
399 | ||
400 | for i=0,6 do | |
401 | ||
402 | feather = newfeather() | |
403 | ||
404 | feather.Mesh.Scale = Vector3.new(1,1,1) | |
405 | ||
406 | feather.Size = Vector3.new(.45,2.2-i*.08,.3) | |
407 | ||
408 | 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))) | |
409 | ||
410 | end | |
411 | ||
412 | local lf1 = {} | |
413 | ||
414 | for i=0,6 do | |
415 | ||
416 | feather = newfeather() | |
417 | ||
418 | feather.Mesh.Scale = Vector3.new(1,1,1) | |
419 | ||
420 | feather.Size = Vector3.new(.37,1.65-i*.06,.25) | |
421 | ||
422 | 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))) | |
423 | ||
424 | end | |
425 | ||
426 | local rwing = {rm1,rm2,rm3,rm4} | |
427 | ||
428 | local lwing = {lm1,lm2,lm3,lm4} | |
429 | ||
430 | local oc0 = {} | |
431 | ||
432 | for i,v in pairs(rwing) do | |
433 | ||
434 | oc0[v] = v.C0 | |
435 | ||
436 | end | |
437 | ||
438 | for i,v in pairs(lwing) do | |
439 | ||
440 | oc0[v] = v.C0 | |
441 | ||
442 | end | |
443 | ||
444 | function gotResized() | |
445 | ||
446 | if lastsize then | |
447 | ||
448 | if tor.Size == lastsize then return end -- This shouldn't happen? | |
449 | ||
450 | local scaleVec = tor.Size/lastsize | |
451 | ||
452 | for i,v in pairs(oc0) do | |
453 | ||
454 | oc0[i] = v-v.p+scaleVec*v.p | |
455 | ||
456 | end | |
457 | ||
458 | lastsize = tor.Size | |
459 | ||
460 | end | |
461 | ||
462 | lastsize = tor.Size | |
463 | ||
464 | end | |
465 | ||
466 | tor.Changed:connect(function(p) | |
467 | ||
468 | if p == "Size" then | |
469 | ||
470 | gotResized() | |
471 | ||
472 | end | |
473 | ||
474 | end) | |
475 | ||
476 | gotResized() | |
477 | ||
478 | local idle = {0,0.5,-.2,0; .05,.05,.1,.05; -.6,-1.5,.1,0;}--0,.3,0,0 | |
479 | ||
480 | local outlow = {-.7,-.2,1.8,0; .3,.05,.1,.05; .2,0,0,0} | |
481 | ||
482 | local outhigh = {.5,-.2,1.8,0; .3,.05,.1,.05; .2,0,0,0} | |
483 | ||
484 | local veryhigh = {.9,-.3,1.9,0; .3,.05,.1,.05; .2,0,0,0} | |
485 | ||
486 | local flap1 = {-.3,.3,1.1,-.2; .3,.05,.1,.05; .2,-.6,0,0} | |
487 | ||
488 | local divebomb = {0,.2,.4,-.7; .3,.05,.1,.05; 0,-.5,-.6,0} | |
489 | ||
490 | ||
491 | function setwings(tab,time) | |
492 | ||
493 | time = time or 10 | |
494 | ||
495 | for i=1,4 do | |
496 | ||
497 | rwing[i].DesiredAngle = tab[i] | |
498 | ||
499 | lwing[i].DesiredAngle = tab[i] | |
500 | ||
501 | rwing[i].MaxVelocity = math.abs(tab[i]-rwing[i].CurrentAngle)/time | |
502 | ||
503 | lwing[i].MaxVelocity = math.abs(tab[i]-lwing[i].CurrentAngle)/time | |
504 | ||
505 | local rcf = oc0[rwing[i]] * (tab[12+i] or CFrame.new()) | |
506 | ||
507 | local lcf = oc0[lwing[i]] * (tab[12+i] or CFrame.new()) | |
508 | ||
509 | end | |
510 | ||
511 | for i,v in pairs(rf1) do | |
512 | ||
513 | v.DesiredAngle = tab[9] | |
514 | ||
515 | v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time | |
516 | ||
517 | end | |
518 | ||
519 | for i,v in pairs(lf1) do | |
520 | ||
521 | v.DesiredAngle = tab[9] | |
522 | ||
523 | v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time | |
524 | ||
525 | end | |
526 | ||
527 | for i,v in pairs(rf2) do | |
528 | ||
529 | v.DesiredAngle = tab[10] | |
530 | ||
531 | v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time | |
532 | ||
533 | end | |
534 | ||
535 | for i,v in pairs(lf2) do | |
536 | ||
537 | v.DesiredAngle = tab[10] | |
538 | ||
539 | v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time | |
540 | ||
541 | end | |
542 | ||
543 | for i,v in pairs(rf3) do | |
544 | ||
545 | v.DesiredAngle = tab[11] | |
546 | ||
547 | v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time | |
548 | ||
549 | end | |
550 | ||
551 | for i,v in pairs(lf3) do | |
552 | ||
553 | v.DesiredAngle = tab[11] | |
554 | ||
555 | v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time | |
556 | ||
557 | end | |
558 | ||
559 | end | |
560 | ||
561 | setwings(outhigh,1) | |
562 | ||
563 | flying = false | |
564 | ||
565 | moving = false | |
566 | ||
567 | for i,v in pairs(tor:GetChildren()) do | |
568 | ||
569 | if v.ClassName:lower():match("body") then | |
570 | ||
571 | v:Destroy() | |
572 | ||
573 | end | |
574 | ||
575 | end | |
576 | ||
577 | local ctor = tor:Clone() | |
578 | ||
579 | ctor:ClearAllChildren() | |
580 | ||
581 | ctor.Name = "cTorso" | |
582 | ||
583 | ctor.Transparency = 1 | |
584 | ||
585 | ctor.CanCollide = false | |
586 | ||
587 | ctor.FormFactor = "Custom" | |
588 | ||
589 | ctor.Size = Vector3.new(.2,.2,.2) | |
590 | ||
591 | ctor.Parent = mod | |
592 | ||
593 | weld(tor,ctor) | |
594 | ||
595 | local bg = Instance.new("BodyGyro",ctor) | |
596 | ||
597 | bg.maxTorque = Vector3.new() | |
598 | ||
599 | bg.P = 15000 | |
600 | ||
601 | bg.D = 1000 | |
602 | ||
603 | local bv = Instance.new("BodyVelocity",ctor) | |
604 | ||
605 | bv.maxForce = Vector3.new() | |
606 | ||
607 | bv.P = 15000 | |
608 | ||
609 | vel = Vector3.new() | |
610 | ||
611 | cf = CFrame.new() | |
612 | ||
613 | flspd = 0 | |
614 | ||
615 | ||
616 | keysdown = {} | |
617 | ||
618 | keypressed = {} | |
619 | ||
620 | ktime = {} | |
621 | ||
622 | descendtimer = 0 | |
623 | ||
624 | jumptime = tick() | |
625 | ||
626 | hum.Jumping:connect(function() | |
627 | ||
628 | jumptime = tick() | |
629 | ||
630 | end) | |
631 | ||
632 | cam = workspace.CurrentCamera | |
633 | ||
634 | kd = plr:GetMouse().KeyDown:connect(oc(function(key) | |
635 | ||
636 | keysdown[key] = true | |
637 | ||
638 | keypressed[key] = true | |
639 | ||
640 | if key == "q" then | |
641 | ||
642 | descendtimer = tick() | |
643 | ||
644 | elseif key == " " and not hum.Jump then | |
645 | ||
646 | jumptime = tick() | |
647 | ||
648 | elseif (key == "a" or key == "d") and ktime[key] and tick()-ktime[key] < .3 and math.abs(reqrotx) < .3 then | |
649 | ||
650 | reqrotx = key == "a" and math.pi*2 or -math.pi*2 | |
651 | ||
652 | end | |
653 | ||
654 | ktime[key] = tick() | |
655 | ||
656 | end)) | |
657 | ||
658 | ku = plr:GetMouse().KeyUp:connect(function(key) | |
659 | ||
660 | keysdown[key] = false | |
661 | ||
662 | if key == " " then | |
663 | ||
664 | descendtimer = tick() | |
665 | ||
666 | end | |
667 | ||
668 | end) | |
669 | ||
670 | function mid(a,b,c) | |
671 | ||
672 | return math.max(a,math.min(b,c or -a)) | |
673 | ||
674 | end | |
675 | ||
676 | function bn(a) | |
677 | ||
678 | return a and 1 or 0 | |
679 | ||
680 | end | |
681 | ||
682 | function gm(tar) | |
683 | ||
684 | local m = 0 | |
685 | ||
686 | for i,v in pairs(tar:GetChildren()) do | |
687 | ||
688 | if v:IsA("BasePart") then | |
689 | ||
690 | m = m + v:GetMass() | |
691 | ||
692 | end | |
693 | ||
694 | m = m + gm(v) | |
695 | ||
696 | end | |
697 | ||
698 | return m | |
699 | ||
700 | end | |
701 | ||
702 | reqrotx = 0 | |
703 | ||
704 | local grav = 196.2 | |
705 | ||
706 | local con | |
707 | ||
708 | con = game:GetService("RunService").Stepped:connect(oc(function() | |
709 | ||
710 | --[[if not mod:IsDescendantOf(workspace) then | |
711 | ||
712 | pcall(function() kd:disconnect() end) | |
713 | ||
714 | pcall(function() ku:disconnect() end) | |
715 | ||
716 | bg:Destroy() | |
717 | ||
718 | bv:Destroy() | |
719 | ||
720 | con:disconnect() | |
721 | ||
722 | script:Destroy() | |
723 | ||
724 | return | |
725 | ||
726 | end]] | |
727 | ||
728 | local obvel = tor.CFrame:vectorToObjectSpace(tor.Velocity) | |
729 | ||
730 | local sspd, uspd,fspd = obvel.X,obvel.Y,obvel.Z | |
731 | ||
732 | if flying then | |
733 | ||
734 | local lfldir = fldir | |
735 | ||
736 | fldir = cam.CoordinateFrame:vectorToWorldSpace(Vector3.new(bn(keysdown.d)-bn(keysdown.a),0,bn(keysdown.s)-bn(keysdown.w))).unit | |
737 | ||
738 | local lmoving = moving | |
739 | ||
740 | moving = fldir.magnitude > .1 | |
741 | ||
742 | if lmoving and not moving then | |
743 | ||
744 | idledir = lfldir*Vector3.new(1,0,1) | |
745 | ||
746 | descendtimer = tick() | |
747 | ||
748 | end | |
749 | ||
750 | local dbomb = fldir.Y < -.6 or (moving and keysdown["1"]) | |
751 | ||
752 | if moving and keysdown["0"] and lmoving then | |
753 | ||
754 | fldir = (Vector3.new(lfldir.X,math.min(fldir.Y,lfldir.Y+.01)-.1,lfldir.Z)+(fldir*Vector3.new(1,0,1))*.05).unit | |
755 | ||
756 | end | |
757 | ||
758 | local down = tor.CFrame:vectorToWorldSpace(Vector3.new(0,-1,0)) | |
759 | ||
760 | local descending = (not moving and keysdown["q"] and not keysdown[" "]) | |
761 | ||
762 | cf = ccomplerp(cf,CFrame.new(tor.Position,tor.Position+(not moving and idledir or fldir)),keysdown["0"] and .02 or .07) | |
763 | ||
764 | local gdown = not dbomb and cf.lookVector.Y < -.2 and tor.Velocity.unit.Y < .05 | |
765 | ||
766 | hum.PlatformStand = true | |
767 | ||
768 | bg.maxTorque = Vector3.new(1,1,1)*9e5 | |
769 | ||
770 | local rotvel = CFrame.new(Vector3.new(),tor.Velocity):toObjectSpace(CFrame.new(Vector3.new(),fldir)).lookVector | |
771 | ||
772 | 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) | |
773 | ||
774 | reqrotx = reqrotx - reqrotx/10 | |
775 | ||
776 | bv.maxForce = Vector3.new(1,1,1)*9e4*.5 | |
777 | ||
778 | local anioff =(bn(keysdown[" "])-bn(keysdown["q"]))/2 | |
779 | ||
780 | local ani = tickwave(1.5-anioff,1) | |
781 | ||
782 | 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) | |
783 | ||
784 | vel = moving and cf.lookVector*flspd or Vector3.new() | |
785 | ||
786 | 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)) | |
787 | ||
788 | setwings(moving and (gdown and outlow or dbomb and divebomb) or (descending and veryhigh or flap1),15) | |
789 | ||
790 | for i=1,4 do | |
791 | ||
792 | --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) | |
793 | ||
794 | 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) | |
795 | ||
796 | 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) | |
797 | ||
798 | end | |
799 | ||
800 | local hit,ray = workspace:FindPartOnRayWithIgnoreList(Ray.new(tor.Position,Vector3.new(0,-3.5+math.min(0,bv.velocity.y)/30,0)),{char}) | |
801 | ||
802 | if hit and down.Y < -.85 and tick()-flystart > 1 then | |
803 | ||
804 | flying = false | |
805 | ||
806 | hum.PlatformStand = false | |
807 | ||
808 | tor.Velocity = Vector3.new() | |
809 | ||
810 | end | |
811 | ||
812 | else | |
813 | ||
814 | bg.maxTorque = Vector3.new() | |
815 | ||
816 | bv.maxForce = Vector3.new() | |
817 | ||
818 | local ani = tickwave(walking and .8 or 4.5,1) | |
819 | ||
820 | setwings(idle,10) | |
821 | ||
822 | local x,y,z = fspd/160,uspd/700,sspd/900 | |
823 | ||
824 | for i=1,4 do | |
825 | ||
826 | 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) | |
827 | ||
828 | 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) | |
829 | ||
830 | end | |
831 | ||
832 | if keypressed[" "] and not flying and (tick()-jumptime > .05 and (tick()-jumptime < 3 or hum.Jump)) then | |
833 | ||
834 | vel = Vector3.new(0,50,0) | |
835 | ||
836 | bv.velocity = vel | |
837 | ||
838 | idledir = cam.CoordinateFrame.lookVector*Vector3.new(1,0,1) | |
839 | ||
840 | cf = tor.CFrame * CFrame.Angles(-.01,0,0) | |
841 | ||
842 | tor.CFrame = cf | |
843 | ||
844 | bg.cframe = cf | |
845 | ||
846 | flystart = tick() | |
847 | ||
848 | flying = true | |
849 | ||
850 | end | |
851 | ||
852 | end | |
853 | ||
854 | keypressed = {} | |
855 | ||
856 | end)) | |
857 | ||
858 | ||
859 | ||
860 | end fly() | |
861 | ||
862 | --Bird Wings By Rosemarijohn2 |