Notepad95

ROBLOX BirdWings

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