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