Advertisement
Nikitos0134

Roblox

Dec 9th, 2024
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.91 KB | Gaming | 0 0
  1. -- Создаем GUI
  2. local player = game.Players.LocalPlayer
  3. local screenGui = Instance.new("ScreenGui")
  4. local mainFrame = Instance.new("Frame")
  5. local titleBar = Instance.new("Frame")
  6. local titleLabel = Instance.new("TextLabel")
  7. local buttonOn = Instance.new("TextButton")
  8. local buttonOff = Instance.new("TextButton")
  9. local closeButton = Instance.new("TextButton")
  10. local flying = false
  11. local speed = 50 -- Скорость полета
  12.  
  13. -- Настройка GUI
  14. screenGui.Parent = player:WaitForChild("PlayerGui")
  15.  
  16. -- Настройка основного фрейма
  17. mainFrame.Parent = screenGui
  18. mainFrame.BackgroundColor3 = Color3.new(1, 1, 1) -- Цвет фона фрейма
  19. mainFrame.Size = UDim2.new(0.3, 0, 0.3, 0)
  20. mainFrame.Position = UDim2.new(0.35, 0, 0.35, 0)
  21. mainFrame.Active = true
  22. mainFrame.Draggable = true -- Делает весь фрейм перетаскиваемым
  23.  
  24. -- Настройка заголовка
  25. titleBar.Parent = mainFrame
  26. titleBar.BackgroundColor3 = Color3.new(0, 0, 0) -- Черная полоса
  27. titleBar.Size = UDim2.new(1, 0, 0.2, 0) -- Высота полосы
  28. titleBar.Position = UDim2.new(0, 0, 0, 0)
  29.  
  30. -- Настройка текста заголовка
  31. titleLabel.Parent = titleBar
  32. titleLabel.Text = "Flight Control"
  33. titleLabel.TextColor3 = Color3.new(1, 1, 1) -- Белый текст
  34. titleLabel.Size = UDim2.new(1, 0, 1, 0)
  35. titleLabel.TextScaled = true
  36. titleLabel.BackgroundTransparency = 1
  37.  
  38. -- Настройка кнопок
  39. local function createButton(button, text, position)
  40.     button.Parent = mainFrame
  41.     button.Text = text
  42.     button.Size = UDim2.new(0.3, 0, 0.2, 0)
  43.     button.Position = position
  44.     button.BackgroundColor3 = Color3.new(0.5, 0.5, 0.5) -- Серый цвет
  45.     button.TextColor3 = Color3.new(1, 1, 1) -- Белый текст
  46.     button.TextScaled = true
  47. end
  48.  
  49. createButton(buttonOn, "ON", UDim2.new(0, 0, 0.3, 0))
  50. createButton(buttonOff, "OFF", UDim2.new(0.7, 0, 0.3, 0))
  51. createButton(closeButton, "X", UDim2.new(0.7, 0, 0.7, 0))
  52.  
  53. -- Функция для включения полета
  54. local function fly()
  55.     local character = player.Character or player.CharacterAdded:Wait()
  56.     local humanoid = character:WaitForChild("Humanoid")
  57.     local rootPart = character:WaitForChild("HumanoidRootPart")
  58.  
  59.     flying = true
  60.     while flying do
  61.         humanoid.PlatformStand = true
  62.         rootPart.Velocity = workspace.CurrentCamera.CFrame.LookVector * speed
  63.         wait(0.1)
  64.     end
  65.     humanoid.PlatformStand = false
  66. end
  67.  
  68. -- Функция для выключения полета
  69. local function stopFlying()
  70.     flying = false
  71. end
  72.  
  73. -- Обработчики кнопок
  74. buttonOn.MouseButton1Click:Connect(fly)
  75. buttonOff.MouseButton1Click:Connect(stopFlying)
  76.  
  77. -- Обработчик кнопки закрытия GUI
  78. closeButton.MouseButton1Click:Connect(function()
  79.     screenGui:Destroy() -- Закрываем GUI
  80. end)
Tags: Script lua
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement