Advertisement
KHSora455

Bird Wings

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