WATCH1LEARN1

Wings

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