Guest User

Wings Script

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