Advertisement
Guest User

Untitled

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