Advertisement
doryna2281337

Untitled

Sep 2nd, 2019
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.93 KB | None | 0 0
  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.  
  84. local player = owner
  85. local char = player.Character
  86. local cam = workspace.CurrentCamera
  87. local Torsoz = char:findFirstChild("Torso")
  88. local RA = char:findFirstChild("Right Arm")
  89. local LA = char:findFirstChild("Left Arm")
  90. local RL = char:findFirstChild("Right Leg")
  91. local LL = char:findFirstChild("Left Leg")
  92. local H = char:findFirstChild("Head")
  93. local RS = Torsoz:findFirstChild("Right Shoulder")
  94. local LS = Torsoz:findFirstChild("Left Shoulder")
  95. local RH = Torsoz:findFirstChild("Right Hip")
  96. local LH = Torsoz:findFirstChild("Left Hip")
  97. local N = Torsoz:findFirstChild("Neck")
  98. local hu = char:findFirstChild("Humanoid")
  99. local Lights = {}
  100. local JetFlames = {}
  101. local LightChangeSpeed = 0.02
  102. local LeftWing
  103. local RightWing
  104. local WingParts = {}
  105. local Flying = false
  106. local JetActive = false
  107. local idle = false
  108. local velo = 0
  109.  
  110. local bp = Instance.new("BodyPosition")
  111. bp.maxForce = Vector3.new(1/0,1/0,1/0)
  112. bp.D = 100
  113. local bg = Instance.new("BodyGyro")
  114. bg.maxTorque = Vector3.new(1/0,1/0,1/0)
  115. bg.D = 320
  116. local bv = Instance.new("BodyVelocity")
  117. bv.maxForce = Vector3.new(1/0,1/0,1/0)
  118.  
  119. local P = Instance.new("Part")
  120. P.Anchored = false
  121. P.CanCollide = false
  122. P.Name = "Part"
  123. P.formFactor = "Custom"
  124. P.Size = Vector3.new(0.5,0.5,0.5)
  125. P.Locked = true
  126. P.TopSurface = 0
  127. P.BottomSurface = 0
  128. P.BrickColor = BrickColor.new("Dark stone grey")
  129. P.Transparency = 0
  130.  
  131. local bp = Instance.new("BodyPosition")
  132. bp.maxForce = Vector3.new(1/0,1/0,1/0)
  133. local bv = Instance.new("BodyVelocity")
  134. bv.maxForce = Vector3.new(1/0,1/0,1/0)
  135. local bg = Instance.new("BodyGyro")
  136. bg.maxTorque = Vector3.new(1/0,1/0,1/0)
  137. bg.D = 300
  138.  
  139. local wingcolor = "Really black"
  140. local maxvelo = 60
  141. local acceleration = 1
  142.  
  143. ---------------------------------- Design ------------------------------------------
  144. for i, v in pairs(char:children()) do
  145. if v.className == "Model" and v.Name == "Pack" then
  146. v:remove()
  147. end
  148. end
  149. local m = Instance.new("Model", char)
  150. m.Name = "Pack"
  151.  
  152. local b = P:Clone()
  153. b.Parent = m
  154. local mesh = Instance.new("SpecialMesh", b)
  155. mesh.MeshType = "Head"
  156. mesh.Scale = Vector3.new(2.6,1.2,2.6)
  157. local w = Instance.new("Motor", b)
  158. w.Part0 = Torsoz
  159. w.Part1 = b
  160. w.C0 = CFrame.new(0,0.2,0.35) * CFrame.Angles(math.pi/2,0,0)
  161. local p = P:Clone()
  162. p.Parent = m
  163. local mesh = Instance.new("SpecialMesh", p)
  164. mesh.MeshType = "Head"
  165. mesh.Scale = Vector3.new(2,1.2,2)
  166. local w = Instance.new("Motor", p)
  167. w.Part0 = Torsoz
  168. w.Part1 = p
  169. w.C0 = CFrame.new(0,0.2,0.45) * CFrame.Angles(math.pi/2,0,0)
  170.  
  171. local p = P:Clone()
  172. p.Parent = m
  173. local mesh = Instance.new("SpecialMesh", p)
  174. mesh.MeshType = "Head"
  175. mesh.Scale = Vector3.new(2.02,1.2,2.02)
  176. local w = Instance.new("Motor", p)
  177. w.Part0 = Torsoz
  178. w.Part1 = p
  179. w.C0 = CFrame.new(0,0.2,0.445) * CFrame.Angles(math.pi/2,0,0)
  180. table.insert(Lights, p)
  181.  
  182. for i = 1, 3 do
  183. local p = P:Clone()
  184. p.Parent = m
  185. local mesh = Instance.new("CylinderMesh", p)
  186. if i == 2 then
  187. mesh.Scale = Vector3.new(0.4,1.2,0.4)
  188. else
  189. mesh.Scale = Vector3.new(0.35,1,0.35)
  190. end
  191. local w = Instance.new("Motor", p)
  192. w.Part0 = Torsoz
  193. w.Part1 = p
  194. w.C0 = CFrame.new(-0.3+(0.15*i),-0.25,0.55)
  195. if i == 2 then
  196. CenterJet = p
  197. end
  198. local l = P:Clone()
  199. l.Parent = m
  200. local mesh = Instance.new("CylinderMesh", l)
  201. local w = Instance.new("Motor", l)
  202. w.Part0 = p
  203. w.Part1 = l
  204. if i == 2 then
  205. mesh.Scale = Vector3.new(0.405,0.12,0.405)
  206. w.C0 = CFrame.new(0,-0.2,0)
  207. else
  208. mesh.Scale = Vector3.new(0.355,0.12,0.355)
  209. w.C0 = CFrame.new(0,-0.15,0)
  210. end
  211. table.insert(Lights, l)
  212. end
  213.  
  214. for i = 1, 3 do
  215. local l = P:Clone()
  216. l.Parent = m
  217. local mesh = Instance.new("CylinderMesh", l)
  218. mesh.Scale = Vector3.new(0.12,0.1,0.12)
  219. local w = Instance.new("Motor", l)
  220. w.Part0 = Torsoz
  221. w.Part1 = l
  222. w.C0 = CFrame.new(0.3-(0.15*i),0.3,0.73) * CFrame.Angles(math.pi/2,0,0)
  223. table.insert(Lights, l)
  224. end
  225.  
  226. ------- wings ------
  227. for i = 0, 1 do
  228. local p = P:Clone()
  229. p.Parent = m
  230. local mesh = Instance.new("SpecialMesh", p)
  231. mesh.MeshType = "Sphere"
  232. mesh.Scale = Vector3.new(1,1,1)
  233. local w = Instance.new("Motor", p)
  234. w.Part0 = Torsoz
  235. w.Part1 = p
  236. w.C0 = CFrame.new(0,0.55,0.55) * CFrame.Angles(0,math.pi*i,0)
  237. w.C1 = CFrame.new(0.425,0,0)
  238.  
  239. local c = P:Clone()
  240. c.Parent = m
  241. c.BrickColor = BrickColor.new(wingcolor)
  242. c.Name = "WingSpine"..i+1
  243. local mesh = Instance.new("BlockMesh", c)
  244. mesh.Scale = Vector3.new(0.26,6,0.2)
  245. local w = Instance.new("Motor", c)
  246. w.Part0 = p
  247. w.Part1 = c
  248. w.C0 = CFrame.Angles(0,0,-math.pi/7)
  249. w.C1 = CFrame.new(0,1.5,0)
  250. w.MaxVelocity = 0.15
  251. if i == 0 then
  252. LeftWing = w
  253. else
  254. RightWing = w
  255. end
  256. table.insert(WingParts, c)
  257. local p = P:Clone()
  258. p.Parent = m
  259. p.BrickColor = BrickColor.new(wingcolor)
  260. local mesh = Instance.new("SpecialMesh", p)
  261. mesh.MeshType = "Wedge"
  262. mesh.Scale = Vector3.new(0.2,4,2.2)
  263. local w = Instance.new("Motor", p)
  264. w.Part0 = c
  265. w.Part1 = p
  266. w.C0 = CFrame.new(0.485,-0.85,0) * CFrame.Angles(math.pi,-math.pi/2,0)
  267. table.insert(WingParts, p)
  268. local p = P:Clone()
  269. p.Parent = m
  270. p.BrickColor = BrickColor.new(wingcolor)
  271. local mesh = Instance.new("BlockMesh", p)
  272. mesh.Scale = Vector3.new(2,0.5,0.2)
  273. local w = Instance.new("Motor", p)
  274. w.Part0 = c
  275. w.Part1 = p
  276. w.C0 = CFrame.new(0.535,0.275,0)
  277. table.insert(WingParts, p)
  278. local p = P:Clone()
  279. p.Parent = m
  280. p.BrickColor = BrickColor.new(wingcolor)
  281. local mesh = Instance.new("SpecialMesh", p)
  282. mesh.MeshType = "Wedge"
  283. mesh.Scale = Vector3.new(0.2,1.5,1)
  284. local w = Instance.new("Motor", p)
  285. w.Part0 = c
  286. w.Part1 = p
  287. w.C0 = CFrame.new(0.785,0.77,0) * CFrame.Angles(0,-math.pi/2,0)
  288. table.insert(WingParts, p)
  289. local p = P:Clone()
  290. p.Parent = m
  291. p.BrickColor = BrickColor.new(wingcolor)
  292. local mesh = Instance.new("BlockMesh", p)
  293. mesh.Scale = Vector3.new(0.94,1.5,0.2)
  294. local w = Instance.new("Motor", p)
  295. w.Part0 = c
  296. w.Part1 = p
  297. w.C0 = CFrame.new(0.3,0.77,0)
  298. table.insert(WingParts, p)
  299. local p = P:Clone()
  300. p.Parent = m
  301. p.BrickColor = BrickColor.new(wingcolor)
  302. local mesh = Instance.new("SpecialMesh", p)
  303. mesh.MeshType = "Wedge"
  304. mesh.Scale = Vector3.new(0.2,1,0.977)
  305. local w = Instance.new("Motor", p)
  306. w.Part0 = c
  307. w.Part1 = p
  308. w.C0 = CFrame.new(0.3,1.385,0) * CFrame.Angles(0,-math.pi/2,0)
  309. table.insert(WingParts, p)
  310.  
  311. end
  312.  
  313. local spacedet = 0
  314. local KEYS = {false, false, false, false}
  315. mouse.KeyDown:connect(function(key)
  316. if key == string.char(32) then
  317. if (tick() - spacedet) < 0.3 then
  318. Flying = not Flying
  319. end
  320. spacedet = tick()
  321. end
  322. if key == "w" then
  323. KEYS[1] = true
  324. end
  325. if key == "a" then
  326. KEYS[2] = true
  327. end
  328. if key == "s" then
  329. KEYS[3] = true
  330. end
  331. if key == "d" then
  332. KEYS[4] = true
  333. end
  334. end)
  335.  
  336. mouse.KeyUp:connect(function(key)
  337. if key == "w" then
  338. KEYS[1] = false
  339. end
  340. if key == "a" then
  341. KEYS[2] = false
  342. end
  343. if key == "s" then
  344. KEYS[3] = false
  345. end
  346. if key == "d" then
  347. KEYS[4] = false
  348. end
  349. end)
  350.  
  351. local LTrailParts = {}
  352. for i = 1, 21 do
  353. local p = P:Clone()
  354. p.Name = "TrailLine"
  355. p.Anchored = true
  356. p.BrickColor = BrickColor.new(wingcolor)
  357. local mesh = Instance.new("CylinderMesh", p)
  358. mesh.Name = "Mesh"
  359. table.insert(LTrailParts, p)
  360. end
  361. local RTrailParts = {}
  362. for i = 1, 21 do
  363. local p = P:Clone()
  364. p.Name = "TrailLine"
  365. p.Anchored = true
  366. p.BrickColor = BrickColor.new(wingcolor)
  367. local mesh = Instance.new("CylinderMesh", p)
  368. mesh.Name = "Mesh"
  369. table.insert(RTrailParts, p)
  370. end
  371. local Loldpos
  372. local Roldpos
  373.  
  374. local lightval = {0.1, true}
  375. local refval = 0.1
  376. local firecolors = {"Bright red", "Bright orange"}
  377. local firespeed = 2
  378. local trailnum = 0
  379. local num = 0
  380. local lastflyaction = false
  381. local lastidleaction = false
  382. local idlebp = {0, 0, Torsoz.Position, true}
  383.  
  384. while true do
  385. num = num + 1
  386. trailnum = trailnum + 1
  387.  
  388. local unitz = (Torsoz.Position - cam.CoordinateFrame.p).unit
  389. local camsight = Torsoz.Position + (unitz*90)
  390. local diff = camsight.y - Torsoz.Position.y
  391.  
  392. ---------------------- Velocity Changes ----------------------------
  393.  
  394. ----------- W key --------------
  395. if KEYS[1] == true then
  396. velo = velo + acceleration
  397. else
  398. if velo > 0 then
  399. local UP = velo - (acceleration/1.5)
  400. if velo > 0 and UP < 0 then
  401. velo = velo + UP
  402. end
  403. velo = velo - (acceleration/1.5)
  404. end
  405. end
  406. ------------ S key -------------
  407. if KEYS[3] == true then
  408. if velo > 0 then
  409. velo = velo - acceleration*1.2
  410. else
  411. velo = velo - (acceleration/1.5)
  412. end
  413. else
  414. if velo < 0 then
  415. local DOWN = velo + acceleration
  416. if velo < 0 and DOWN > 0 then
  417. velo = velo - DOWN
  418. end
  419. velo = velo + acceleration
  420. end
  421. end
  422.  
  423. local maxvelocalc = maxvelo
  424. if diff < -35 then
  425. if velo > 0 then
  426. maxvelocalc = maxvelo + (maxvelo * -(((diff+35)/110)))
  427. end
  428. elseif diff > 35 then
  429. if velo < 0 then
  430. maxvelocalc = maxvelo + (maxvelo * -((((-diff)+35)/110)))
  431. end
  432. end
  433.  
  434. if velo >= maxvelocalc then
  435. velo = maxvelocalc
  436. elseif velo <= -maxvelocalc/2 then
  437. velo = -maxvelocalc/2
  438. end
  439.  
  440. ------------------------- Lights ----------------------
  441. if lightval[1] < 0.15 then
  442. lightval[2] = true
  443. elseif lightval[1] > 0.76 then
  444. lightval[2] = false
  445. end
  446. if lightval[2] == true then
  447. lightval[1] = lightval[1] + LightChangeSpeed
  448. else
  449. lightval[1] = lightval[1] - LightChangeSpeed
  450. end
  451. for i, v in pairs(Lights) do
  452. v.Transparency = lightval[1]
  453. if LightChangeSpeed > 0.15 then
  454. v.BrickColor = BrickColor.new("Bright red")
  455. elseif LightChangeSpeed > 0.08 then
  456. v.BrickColor = BrickColor.new("Bright orange")
  457. else
  458. v.BrickColor = BrickColor.new("Bright green")
  459. end
  460. end
  461. --------------------------------------------------------
  462.  
  463. --------------------- Wing Shines -------------------------
  464. for i, v in pairs(WingParts) do
  465. if Flying == true then
  466. if v.Reflectance > 0.19 then
  467. v.Reflectance = v.Reflectance - 0.035
  468. else
  469. v.Reflectance = 0.19
  470. end
  471. else
  472. if v.Reflectance < 0.43 then
  473. v.Reflectance = v.Reflectance + 0.035
  474. else
  475. v.Reflectance = 0.43
  476. end
  477. end
  478. end
  479. ----------------------------------------------------
  480.  
  481. ------------------------ Jet Boost Flames --------------------------------
  482. if num%firespeed == 0 and JetActive == true then
  483. local f = P:Clone()
  484. f.Parent = m
  485. f.Name = "JetFire"
  486. f.BrickColor = BrickColor.new(firecolors[math.random(1, #firecolors)])
  487. f.Transparency = 0.15
  488. f.Anchored = true
  489. f.CFrame = CenterJet.CFrame * CFrame.new(0,-0.3,0)
  490. local mesh = Instance.new("BlockMesh", f)
  491. mesh.Scale = Vector3.new(0.6,0.6,0.6)
  492. table.insert(JetFlames, {mesh, (f.Position - CenterJet.Position).unit})
  493. end
  494.  
  495. for i, v in pairs(JetFlames) do
  496. if v[1].Parent.Transparency < 0.9 then
  497. v[1].Parent.Transparency = v[1].Parent.Transparency + 0.03
  498. v[1].Scale = v[1].Scale + Vector3.new(0.08,0.08,0.08)
  499. v[1].Parent.CFrame = v[1].Parent.CFrame * CFrame.Angles(math.random(-180,180)/360,math.random(-180,180)/360,math.random(-180,180)/360)
  500. if idle == false then
  501. v[1].Parent.CFrame = v[1].Parent.CFrame + (v[2]*0.1)
  502. else
  503. v[1].Parent.CFrame = v[1].Parent.CFrame + (v[2]*0.24)
  504. end
  505. else
  506. v[1].Parent:remove()
  507. table.remove(JetFlames, i)
  508. end
  509. end
  510. --------------------------------------------------
  511.  
  512. ------------------------------ Flying --------------------------------
  513.  
  514. if Flying == true then
  515.  
  516. if lastflyaction == false then
  517. bg = Instance.new("BodyGyro", Torsoz)
  518. bg.maxTorque = Vector3.new(1/0,1/0,1/0)
  519. bg.D = 350
  520. end
  521.  
  522.  
  523. --------- idle checker --------
  524. if (velo > -0.5 and velo < 0.5) and (KEYS[1] == false and KEYS[3] == false) then
  525. idle = true
  526. if lastidleaction == false then
  527. idlebp[3] = Torsoz.Position
  528. end
  529. else
  530. idle = false
  531. end
  532.  
  533. --------- idle float anim -----------
  534. if idle == true then
  535. if lastidleaction == false then
  536. idlebp = {0, 0, Torsoz.Position, true}
  537. end
  538. if idlebp[2] >= 0.3 then
  539. idlebp[4] = false
  540. elseif idlebp[2] <= -0.3 then
  541. idlebp[4] = true
  542. end
  543. if idlebp[4] == false then
  544. idlebp[2] = idlebp[2] - 0.02
  545. elseif idlebp[4] == true then
  546. idlebp[2] = idlebp[2] + 0.02
  547. end
  548. idlebp[1] = idlebp[1] + idlebp[2]
  549. end
  550.  
  551. ---------------- Body Objects ----------------------
  552.  
  553. if idle == true then
  554. if lastidleaction == false then
  555. bv:remove()
  556. bp:remove()
  557. bp = Instance.new("BodyPosition")
  558. end
  559. hu.PlatformStand = true
  560. bp.Parent = Torsoz
  561. bp.maxForce = Vector3.new(1/0,1/0,1/0)
  562. bp.D = 100
  563. bp.position = idlebp[3] + Vector3.new(0,idlebp[1],0)
  564. bg.cframe = CFrame.new(Torsoz.Position, Torsoz.Position + cam.CoordinateFrame.lookVector)
  565. else
  566. if lastidleaction == true then
  567. bp:remove()
  568. bv:remove()
  569. bv = Instance.new("BodyVelocity")
  570. end
  571. hu.PlatformStand = true
  572. bv.Parent = Torsoz
  573. bv.maxForce = Vector3.new(1/0,1/0,1/0)
  574. local torpos = Torsoz.Position + (cam.CoordinateFrame.lookVector * 10)
  575. bv.velocity = CFrame.new(Torsoz.Position+Vector3.new(0,-2,0), torpos).lookVector*velo
  576. local cvelo = velo
  577. if velo > maxvelo then
  578. cvelo = maxvelo
  579. end
  580. bg.cframe = CFrame.new(Torsoz.Position, Torsoz.Position + cam.CoordinateFrame.lookVector) * CFrame.Angles((-math.pi/2.3)*(cvelo/maxvelo),0,0)
  581.  
  582. end
  583.  
  584. elseif Flying == false then
  585. if lastflyaction == true then
  586. hu.PlatformStand = false
  587. bp.Parent = nil
  588. bg.Parent = nil
  589. bv.Parent = nil
  590. idle = false
  591. end
  592.  
  593. end --- if flying == true
  594.  
  595. -----------------------------------------
  596.  
  597. ----------------------- Auto Anims -----------------------
  598. if Flying == true then
  599. if diff > 40 then
  600. LeftWing.DesiredAngle = -0.3
  601. RightWing.DesiredAngle = -0.3
  602. LightChangeSpeed = 0.24
  603. JetActive = true
  604. ActiveTrails = true
  605. firespeed = 1
  606. elseif diff > -22 and diff < 40 then
  607. LeftWing.DesiredAngle = -math.pi/2.5
  608. RightWing.DesiredAngle = -math.pi/2.5
  609. LightChangeSpeed = 0.09
  610. JetActive = true
  611. ActiveTrails = true
  612. firespeed = 2
  613. elseif diff > -60 and diff < -22 then
  614. LeftWing.DesiredAngle = -math.pi/2.5
  615. RightWing.DesiredAngle = -math.pi/2.5
  616. LightChangeSpeed = 0.04
  617. JetActive = false
  618. ActiveTrails = true
  619. elseif diff < -60 then
  620. LeftWing.DesiredAngle = -0.1
  621. RightWing.DesiredAngle = -0.1
  622. LightChangeSpeed = 0.04
  623. JetActive = false
  624. ActiveTrails = true
  625. end
  626. if idle == true then
  627. LeftWing.DesiredAngle = -math.pi/2.2
  628. RightWing.DesiredAngle = -math.pi/2.2
  629. LightChangeSpeed = 0.09
  630. JetActive = true
  631. ActiveTrails = false
  632. firespeed = 1
  633. end
  634. if diff < -40 and velo < 0 then
  635. LeftWing.DesiredAngle = -0.3
  636. RightWing.DesiredAngle = -0.3
  637. LightChangeSpeed = 0.24
  638. JetActive = true
  639. ActiveTrails = true
  640. firespeed = 1
  641. elseif (diff < -22 and diff > -40) and velo < 0 then
  642. LeftWing.DesiredAngle = -math.pi/2.5
  643. RightWing.DesiredAngle = -math.pi/2.5
  644. LightChangeSpeed = 0.09
  645. JetActive = true
  646. ActiveTrails = true
  647. firespeed = 2
  648. end
  649. else
  650. LeftWing.DesiredAngle = 0
  651. RightWing.DesiredAngle = 0
  652. JetActive = false
  653. ActiveTrails = false
  654. LightChangeSpeed = 0.02
  655. end
  656. -----------------------------------------
  657.  
  658. ------------------------ Trail lines ------------------------------
  659. if num%2 == 0 then
  660.  
  661. if Flying == true and ActiveTrails == true then
  662. if velo > 0 then
  663. if velo < acceleration*7 then
  664. Loldpos = nil
  665. Roldpos = nil
  666. end
  667. elseif velo < 0 then
  668. if velo > -acceleration*7 then
  669. Loldpos = nil
  670. Roldpos = nil
  671. end
  672. end
  673.  
  674. if Loldpos ~= nil then
  675. local newpos = (LeftWing.Parent.CFrame * CFrame.new(0,-1.7,0)).p
  676. local t = LTrailParts[trailnum]
  677. t.Parent = m
  678. t.Anchored = true
  679. t.BrickColor = BrickColor.new(wingcolor)
  680. t.CFrame = CFrame.new((Loldpos+newpos)/2,Loldpos) * CFrame.Angles(math.pi/2,0,0)
  681. local mesh = Instance.new("CylinderMesh", t)
  682. mesh.Name = "Mesh"
  683. mesh.Scale = Vector3.new(0.2,(Loldpos - newpos).magnitude*2,0.2)
  684. end
  685. if Roldpos ~= nil then
  686. local newpos = (RightWing.Parent.CFrame * CFrame.new(0,-1.7,0)).p
  687. local t = RTrailParts[trailnum]
  688. t.Parent = m
  689. t.Anchored = true
  690. t.BrickColor = BrickColor.new(wingcolor)
  691. t.CFrame = CFrame.new((Roldpos+newpos)/2,Roldpos) * CFrame.Angles(math.pi/2,0,0)
  692. local mesh = Instance.new("CylinderMesh", t)
  693. mesh.Name = "Mesh"
  694. mesh.Scale = Vector3.new(0.2,(Roldpos - newpos).magnitude*2,0.2)
  695. end
  696. Loldpos = (LeftWing.Parent.CFrame * CFrame.new(0,-1.7,0)).p
  697. Roldpos = (RightWing.Parent.CFrame * CFrame.new(0,-1.7,0)).p
  698.  
  699. else
  700. LTrailParts[trailnum].Parent = nil
  701. RTrailParts[trailnum].Parent = nil
  702. Loldpos = (LeftWing.Parent.CFrame * CFrame.new(0,-1.7,0)).p
  703. Roldpos = (RightWing.Parent.CFrame * CFrame.new(0,-1.7,0)).p
  704. end
  705.  
  706. end
  707.  
  708. if trailnum == #LTrailParts-1 then
  709. trailnum = 0
  710. end
  711.  
  712. if num%800 == 0 then
  713. for i, v in pairs(LTrailParts) do
  714. game:service("Debris"):AddItem(v, 0.7)
  715. end
  716. for i, v in pairs(RTrailParts) do
  717. game:service("Debris"):AddItem(v, 0.7)
  718. end
  719. LTrailParts = {}
  720. for i = 1, 21 do
  721. local p = P:Clone()
  722. p.Name = "LTrailLine"
  723. p.Anchored = true
  724. p.BrickColor = BrickColor.new(wingcolor)
  725. local mesh = Instance.new("CylinderMesh", p)
  726. mesh.Name = "Mesh"
  727. table.insert(LTrailParts, p)
  728. end
  729. RTrailParts = {}
  730. for i = 1, 21 do
  731. local p = P:Clone()
  732. p.Name = "RTrailLine"
  733. p.Anchored = true
  734. p.BrickColor = BrickColor.new(wingcolor)
  735. local mesh = Instance.new("CylinderMesh", p)
  736. mesh.Name = "Mesh"
  737. table.insert(RTrailParts, p)
  738. end
  739. end
  740.  
  741. ----------------------------------------------
  742.  
  743. lastflyaction = Flying
  744. lastidleaction = idle
  745. wait(0.03)
  746. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement