iOSdeveloper

Untitled

Jun 16th, 2025
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.39 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2. local RunService = game:GetService("RunService")
  3. local UserInputService = game:GetService("UserInputService")
  4. local Workspace = game:GetService("Workspace")
  5.  
  6. local player = Players.LocalPlayer
  7. local character = player.Character or player.CharacterAdded:Wait()
  8. local hrp = character:WaitForChild("HumanoidRootPart")
  9. local camera = Workspace.CurrentCamera
  10.  
  11. local flySpeed = 50
  12. local isFlying = false
  13. local bodyVelocity = nil
  14. local upPressed, downPressed = false, false
  15.  
  16. local screenGui = Instance.new("ScreenGui")
  17. screenGui.Name = "FlyUI"
  18. screenGui.ResetOnSpawn = false
  19. screenGui.Parent = player:WaitForChild("PlayerGui")
  20.  
  21. local mainFrame = Instance.new("Frame")
  22. mainFrame.Size = UDim2.new(0, 150, 0, 120)
  23. mainFrame.Position = UDim2.new(1, -160, 1, -140)
  24. mainFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
  25. mainFrame.Active = true
  26. mainFrame.Draggable = true
  27. mainFrame.Parent = screenGui
  28.  
  29. Instance.new("UICorner", mainFrame).CornerRadius = UDim.new(0, 12)
  30.  
  31. local toggle = Instance.new("TextButton")
  32. toggle.Size = UDim2.new(1, -10, 0, 40)
  33. toggle.Position = UDim2.new(0, 5, 0, 5)
  34. toggle.Text = "FLY: OFF"
  35. toggle.BackgroundColor3 = Color3.fromRGB(100, 150, 255)
  36. toggle.TextColor3 = Color3.new(1, 1, 1)
  37. toggle.Font = Enum.Font.GothamBold
  38. toggle.TextScaled = true
  39. toggle.Parent = mainFrame
  40.  
  41. local upBtn = Instance.new("TextButton")
  42. upBtn.Size = UDim2.new(0.48, 0, 0, 30)
  43. upBtn.Position = UDim2.new(0.02, 0, 0, 50)
  44. upBtn.Text = "⬆️"
  45. upBtn.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
  46. upBtn.TextColor3 = Color3.new(1, 1, 1)
  47. upBtn.Font = Enum.Font.GothamBold
  48. upBtn.TextScaled = true
  49. upBtn.Parent = mainFrame
  50. Instance.new("UICorner", upBtn).CornerRadius = UDim.new(0, 6)
  51.  
  52. local downBtn = Instance.new("TextButton")
  53. downBtn.Size = UDim2.new(0.48, 0, 0, 30)
  54. downBtn.Position = UDim2.new(0.5, 0, 0, 50)
  55. downBtn.Text = "⬇️"
  56. downBtn.BackgroundColor3 = Color3.fromRGB(255, 100, 100)
  57. downBtn.TextColor3 = Color3.new(1, 1, 1)
  58. downBtn.Font = Enum.Font.GothamBold
  59. downBtn.TextScaled = true
  60. downBtn.Parent = mainFrame
  61. Instance.new("UICorner", downBtn).CornerRadius = UDim.new(0, 6)
  62.  
  63. local function startFlying()
  64. if isFlying then return end
  65. isFlying = true
  66.  
  67. bodyVelocity = Instance.new("BodyVelocity")
  68. bodyVelocity.Velocity = Vector3.zero
  69. bodyVelocity.MaxForce = Vector3.new(4000, 4000, 4000)
  70. bodyVelocity.P = 1250
  71. bodyVelocity.Parent = hrp
  72.  
  73. toggle.Text = "FLY: ON"
  74. end
  75.  
  76. local function stopFlying()
  77. isFlying = false
  78. if bodyVelocity then
  79. bodyVelocity:Destroy()
  80. bodyVelocity = nil
  81. end
  82. toggle.Text = "FLY: OFF"
  83. end
  84.  
  85. toggle.MouseButton1Click:Connect(function()
  86. if isFlying then
  87. stopFlying()
  88. else
  89. startFlying()
  90. end
  91. end)
  92.  
  93. upBtn.MouseButton1Down:Connect(function() upPressed = true end)
  94. upBtn.MouseButton1Up:Connect(function() upPressed = false end)
  95. downBtn.MouseButton1Down:Connect(function() downPressed = true end)
  96. downBtn.MouseButton1Up:Connect(function() downPressed = false end)
  97.  
  98. RunService.Heartbeat:Connect(function()
  99. if isFlying and bodyVelocity and hrp then
  100.  
  101. local camLook = camera.CFrame.LookVector
  102.  
  103. local forward = Vector3.new(camLook.X, 0, camLook.Z).Unit * flySpeed
  104.  
  105. local verticalVelocity = 0
  106. if upPressed then verticalVelocity = flySpeed end
  107. if downPressed then verticalVelocity = -flySpeed end
  108.  
  109. bodyVelocity.Velocity = forward + Vector3.new(0, verticalVelocity, 0)
  110. end
  111. end)
  112.  
Advertisement
Add Comment
Please, Sign In to add comment