Advertisement
Guest User

Wings

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