Advertisement
SCR1PT_ED1T0R

FE Wings

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