Advertisement
Mitko1223tm

wings test

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