FAXFR

Untitled

Jan 3rd, 2026
3,556
0
Never
4
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.69 KB | None | 0 0
  1. -- Fly Script with Admin-style Features & Flying Animation
  2. -- Press F to toggle flight mode - Enhanced turning speed
  3.  
  4. -- Configuration
  5. local flySpeed = 50
  6. local turnSpeed = 120 -- Increased turning speed
  7. local flyEnabled = false
  8. local player = game.Players.LocalPlayer
  9. local character = player.Character or player.CharacterAdded:Wait()
  10. local humanoid = character:WaitForChild("Humanoid")
  11. local rootPart = character:WaitForChild("HumanoidRootPart")
  12. local animate = character:WaitForChild("Animate")
  13.  
  14. -- Flight setup
  15. local bodyVelocity
  16. local bodyGyro
  17. local flightAnimationTrack
  18. local flyingAnimation
  19.  
  20. -- Load flying animation
  21. local function loadFlyingAnimation()
  22. if character and humanoid then
  23. -- Create flying animation
  24. flyingAnimation = Instance.new("Animation")
  25. flyingAnimation.AnimationId = "rbxassetid://3541114300" -- Flying animation
  26.  
  27. -- Load the animation track
  28. flightAnimationTrack = humanoid:LoadAnimation(flyingAnimation)
  29. flightAnimationTrack.Priority = Enum.AnimationPriority.Action
  30. flightAnimationTrack.Looped = true
  31. end
  32. end
  33.  
  34. -- Initialize animation
  35. loadFlyingAnimation()
  36.  
  37. -- Toggle flight function
  38. local function toggleFlight()
  39. flyEnabled = not flyEnabled
  40.  
  41. if flyEnabled then
  42. -- Stop default animations
  43. if animate then
  44. for _, track in pairs(animate:GetChildren()) do
  45. if track:IsA("AnimationTrack") then
  46. track:Stop()
  47. end
  48. end
  49. end
  50.  
  51. -- Play flying animation
  52. if flightAnimationTrack then
  53. flightAnimationTrack:Play()
  54. flightAnimationTrack:AdjustSpeed(1.2) -- Slightly faster flying animation
  55. end
  56.  
  57. -- Create flight controls
  58. bodyVelocity = Instance.new("BodyVelocity")
  59. bodyGyro = Instance.new("BodyGyro")
  60.  
  61. bodyVelocity.Velocity = Vector3.new(0, 0, 0)
  62. bodyVelocity.MaxForce = Vector3.new(40000, 40000, 40000)
  63. bodyVelocity.P = 10000
  64.  
  65. bodyGyro.MaxTorque = Vector3.new(40000, 40000, 40000)
  66. bodyGyro.P = 8000
  67. bodyGyro.D = 100
  68. bodyGyro.CFrame = rootPart.CFrame
  69.  
  70. bodyVelocity.Parent = rootPart
  71. bodyGyro.Parent = rootPart
  72.  
  73. humanoid.PlatformStand = true
  74.  
  75. -- Adjust humanoid for flying state
  76. humanoid.WalkSpeed = 0
  77. humanoid.JumpPower = 0
  78.  
  79. -- Notify player
  80. game.StarterGui:SetCore("SendNotification", {
  81. Title = "🦅 Flight Mode",
  82. Text = "ENABLED\nWASD to move | F to disable",
  83. Duration = 3,
  84. Icon = "rbxassetid://4483345998"
  85. })
  86.  
  87. -- Flight movement loop
  88. local flightConnection
  89. flightConnection = game:GetService("RunService").RenderStepped:Connect(function(deltaTime)
  90. if not flyEnabled or not character or not rootPart then
  91. flightConnection:Disconnect()
  92. return
  93. end
  94.  
  95. local camera = workspace.CurrentCamera
  96. local moveDirection = Vector3.new(0, 0, 0)
  97.  
  98. -- Get camera look vector for movement direction
  99. local lookVector = camera.CFrame.LookVector
  100. local rightVector = camera.CFrame.RightVector
  101.  
  102. -- Forward/Backward (W/S)
  103. if game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.W) then
  104. moveDirection = moveDirection + (lookVector * flySpeed)
  105. end
  106. if game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.S) then
  107. moveDirection = moveDirection - (lookVector * flySpeed)
  108. end
  109.  
  110. -- Left/Right (A/D)
  111. if game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.A) then
  112. moveDirection = moveDirection - (rightVector * flySpeed)
  113. end
  114. if game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.D) then
  115. moveDirection = moveDirection + (rightVector * flySpeed)
  116. end
  117.  
  118. -- Up/Down (Space/LeftShift or Q/E)
  119. if game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.Space) or
  120. game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.E) then
  121. moveDirection = moveDirection + Vector3.new(0, flySpeed, 0)
  122. end
  123. if game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.LeftShift) or
  124. game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.Q) then
  125. moveDirection = moveDirection - Vector3.new(0, flySpeed, 0)
  126. end
  127.  
  128. -- Apply movement if any direction is pressed
  129. if moveDirection.Magnitude > 0 then
  130. bodyVelocity.Velocity = moveDirection
  131.  
  132. -- Adjust animation speed based on movement speed
  133. if flightAnimationTrack then
  134. local speedMultiplier = 0.8 + (moveDirection.Magnitude / flySpeed) * 0.4
  135. flightAnimationTrack:AdjustSpeed(speedMultiplier)
  136. end
  137. else
  138. bodyVelocity.Velocity = Vector3.new(0, 0, 0)
  139.  
  140. -- Slow animation when hovering
  141. if flightAnimationTrack then
  142. flightAnimationTrack:AdjustSpeed(0.6)
  143. end
  144. end
  145.  
  146. -- Update gyro for turning
  147. bodyGyro.CFrame = CFrame.new(rootPart.Position, rootPart.Position + lookVector)
  148.  
  149. end)
  150.  
  151. else
  152. -- Stop flying animation
  153. if flightAnimationTrack then
  154. flightAnimationTrack:Stop()
  155. end
  156.  
  157. -- Reset animations
  158. if animate then
  159. for _, track in pairs(animate:GetChildren()) do
  160. if track:IsA("AnimationTrack") then
  161. track:Play()
  162. end
  163. end
  164. end
  165.  
  166. -- Disable flight
  167. if bodyVelocity then
  168. bodyVelocity:Destroy()
  169. bodyVelocity = nil
  170. end
  171. if bodyGyro then
  172. bodyGyro:Destroy()
  173. bodyGyro = nil
  174. end
  175.  
  176. humanoid.PlatformStand = false
  177.  
  178. -- Reset humanoid state
  179. humanoid.WalkSpeed = 16
  180. humanoid.JumpPower = 50
  181. humanoid:ChangeState(Enum.HumanoidStateType.Landed)
  182.  
  183. -- Play landing animation
  184. if character:FindFirstChild("Humanoid") then
  185. humanoid:ChangeState(Enum.HumanoidStateType.Landed)
  186. end
  187.  
  188. -- Notify player
  189. game.StarterGui:SetCore("SendNotification", {
  190. Title = "🦅 Flight Mode",
  191. Text = "DISABLED",
  192. Duration = 3,
  193. Icon = "rbxassetid://4483345998"
  194. })
  195. end
  196. end
  197.  
  198. -- Enhanced mouse control for turning while flying
  199. local mouse = player:GetMouse()
  200. local lastMousePosition
  201.  
  202. mouse.Button2Down:Connect(function()
  203. if flyEnabled then
  204. lastMousePosition = Vector2.new(mouse.X, mouse.Y)
  205.  
  206. -- Mouse movement for camera control while flying
  207. local mouseMoveConnection
  208. mouseMoveConnection = mouse.Move:Connect(function()
  209. if not flyEnabled or not lastMousePosition then
  210. mouseMoveConnection:Disconnect()
  211. return
  212. end
  213.  
  214. local delta = Vector2.new(mouse.X - lastMousePosition.X, mouse.Y - lastMousePosition.Y)
  215. lastMousePosition = Vector2.new(mouse.X, mouse.Y)
  216.  
  217. -- Apply rotation based on mouse movement
  218. if bodyGyro then
  219. local currentCFrame = bodyGyro.CFrame
  220. local rotation = CFrame.fromEulerAnglesYXZ(
  221. -delta.Y * turnSpeed * 0.001,
  222. -delta.X * turnSpeed * 0.001,
  223. 0
  224. )
  225. bodyGyro.CFrame = currentCFrame * rotation
  226. end
  227. end)
  228.  
  229. -- Disconnect when mouse button is released
  230. mouse.Button2Up:Connect(function()
  231. if mouseMoveConnection then
  232. mouseMoveConnection:Disconnect()
  233. end
  234. lastMousePosition = nil
  235. end)
  236. end
  237. end)
  238.  
  239. -- Key press detection
  240. local uis = game:GetService("UserInputService")
  241. uis.InputBegan:Connect(function(input, processed)
  242. if not processed and input.KeyCode == Enum.KeyCode.F then
  243. toggleFlight()
  244. end
  245. end)
  246.  
  247. -- Character reconnection handling
  248. player.CharacterAdded:Connect(function(newCharacter)
  249. character = newCharacter
  250. humanoid = character:WaitForChild("Humanoid")
  251. rootPart = character:WaitForChild("HumanoidRootPart")
  252. animate = character:WaitForChild("Animate")
  253.  
  254. -- Reset flight state on character change
  255. flyEnabled = false
  256. if bodyVelocity then bodyVelocity:Destroy() end
  257. if bodyGyro then bodyGyro:Destroy() end
  258.  
  259. -- Reload animation for new character
  260. loadFlyingAnimation()
  261. end)
  262.  
  263. -- Adjust fly speed with key binds
  264. uis.InputBegan:Connect(function(input, processed)
  265. if not processed and flyEnabled then
  266. if input.KeyCode == Enum.KeyCode.PageUp then
  267. turnSpeed = math.min(turnSpeed + 20, 200)
  268. game.StarterGui:SetCore("SendNotification", {
  269. Title = "Turn Speed",
  270. Text = "Increased to: " .. turnSpeed,
  271. Duration = 2
  272. })
  273. elseif input.KeyCode == Enum.KeyCode.PageDown then
  274. turnSpeed = math.max(turnSpeed - 20, 20)
  275. game.StarterGui:SetCore("SendNotification", {
  276. Title = "Turn Speed",
  277. Text = "Decreased to: " .. turnSpeed,
  278. Duration = 2
  279. })
  280. elseif input.KeyCode == Enum.KeyCode.Equals then
  281. flySpeed = math.min(flySpeed + 10, 100)
  282. game.StarterGui:SetCore("SendNotification", {
  283. Title = "Fly Speed",
  284. Text = "Increased to: " .. flySpeed,
  285. Duration = 2
  286. })
  287. elseif input.KeyCode == Enum.KeyCode.Minus then
  288. flySpeed = math.max(flySpeed - 10, 10)
  289. game.StarterGui:SetCore("SendNotification", {
  290. Title = "Fly Speed",
  291. Text = "Decreased to: " .. flySpeed,
  292. Duration = 2
  293. })
  294. end
  295. end
  296. end)
  297.  
  298. -- Optional: Visual effects when flying
  299. local function createFlightEffects()
  300. if not character then return end
  301.  
  302. -- Create particle effects for flying
  303. local flightParticles = Instance.new("ParticleEmitter")
  304. flightParticles.Parent = rootPart
  305. flightParticles.Color = ColorSequence.new(Color3.fromRGB(100, 149, 237))
  306. flightParticles.Size = NumberSequence.new(0.5)
  307. flightParticles.Transparency = NumberSequence.new(0.5)
  308. flightParticles.Lifetime = NumberRange.new(0.5)
  309. flightParticles.Rate = 20
  310. flightParticles.Speed = NumberRange.new(2)
  311. flightParticles.VelocitySpread = 180
  312. flightParticles.Acceleration = Vector3.new(0, -10, 0)
  313.  
  314. return flightParticles
  315. end
  316.  
  317. -- Toggle effects based on preference
  318. local useEffects = false
  319. local flightEffects
  320.  
  321. -- Initial notification
  322. game.StarterGui:SetCore("SendNotification", {
  323. Title = "🦅 Flight Script Loaded",
  324. Text = "Press F to toggle flight\nRight click + drag for camera control\nPageUp/PageDown = Turn Speed\n+/- = Fly Speed",
  325. Duration = 6,
  326. Icon = "rbxassetid://6559555125"
  327. })
  328.  
  329. print("Enhanced fly script with animation loaded!")
  330. print("Turn Speed: " .. turnSpeed)
  331. print("Fly Speed: " .. flySpeed)
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
Add Comment
Please, Sign In to add comment