Advertisement
Guest User

Topkek-NasuLeak:Wings

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