Advertisement
memberhero

wings

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