-- Gui to Lua -- Version: 3.2 -- Instances: local ScreenGui = Instance.new("ScreenGui") local Frame = Instance.new("Frame") local TextLabel = Instance.new("TextLabel") local TextButton = Instance.new("TextButton") -- Properties: ScreenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui") ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling Frame.Parent = ScreenGui Frame.BackgroundColor3 = Color3.fromRGB(43, 255, 121) Frame.BorderColor3 = Color3.fromRGB(0, 0, 0) Frame.BorderSizePixel = 0 Frame.Position = UDim2.new(0.113886848, 0, 0.225967541, 0) Frame.Size = UDim2.new(0, 177, 0, 162) Frame.Active = true -- Required for dragging to work smoothly TextLabel.Parent = Frame TextLabel.BackgroundColor3 = Color3.fromRGB(255, 85, 255) TextLabel.BorderColor3 = Color3.fromRGB(0, 0, 0) TextLabel.BorderSizePixel = 0 TextLabel.Size = UDim2.new(0, 177, 0, 50) TextLabel.Font = Enum.Font.SourceSans TextLabel.Text = "FLY SCRIPT" TextLabel.TextColor3 = Color3.fromRGB(0, 0, 0) TextLabel.TextSize = 14.000 TextButton.Parent = Frame TextButton.BackgroundColor3 = Color3.fromRGB(151, 255, 128) TextButton.BorderColor3 = Color3.fromRGB(0, 0, 0) TextButton.BorderSizePixel = 0 TextButton.Position = UDim2.new(0, 0, 0.30864197, 0) TextButton.Size = UDim2.new(0, 177, 0, 112) TextButton.Font = Enum.Font.SourceSans TextButton.Text = "FLY" TextButton.TextColor3 = Color3.fromRGB(0, 0, 0) TextButton.TextSize = 14.000 -- ========================================== -- DRAGGABLE GUI LOGIC -- ========================================== local UserInputService = game:GetService("UserInputService") local dragging local dragInput local dragStart local startPos local function update(input) local delta = input.Position - dragStart Frame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y) end Frame.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true dragStart = input.Position startPos = Frame.Position input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then dragging = false end end) end end) Frame.InputChanged:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then dragInput = input end end) UserInputService.InputChanged:Connect(function(input) if input == dragInput and dragging then update(input) end end) -- ========================================== -- FLY SCRIPT LOGIC -- ========================================== local player = game.Players.LocalPlayer local isFlying = false local flySpeed = 50 local function toggleFly() isFlying = not isFlying TextButton.Text = isFlying and "UNFLY" or "FLY" local character = player.Character if not character then return end local humanoidRootPart = character:FindFirstChild("HumanoidRootPart") local humanoid = character:FindFirstChildOfClass("Humanoid") if not humanoidRootPart or not humanoid then return end if isFlying then humanoid.PlatformStand = true -- Fly Loop task.spawn(function() -- Create forces to hold character in air smoothly local bv = Instance.new("BodyVelocity") bv.Velocity = Vector3.new(0,0,0) bv.MaxForce = Vector3.new(10000, 10000, 10000) bv.Parent = humanoidRootPart local bg = Instance.new("BodyGyro") bg.CFrame = humanoidRootPart.CFrame bg.MaxTorque = Vector3.new(10000, 10000, 10000) bg.Parent = humanoidRootPart local camera = workspace.CurrentCamera while isFlying and character.Parent and humanoidRootPart.Parent do local moveDirection = Vector3.new(0, 0, 0) if UserInputService:IsKeyDown(Enum.KeyCode.W) then moveDirection += Vector3.new(0, 0, -1) end if UserInputService:IsKeyDown(Enum.KeyCode.S) then moveDirection += Vector3.new(0, 0, 1) end if UserInputService:IsKeyDown(Enum.KeyCode.A) then moveDirection += Vector3.new(-1, 0, 0) end if UserInputService:IsKeyDown(Enum.KeyCode.D) then moveDirection += Vector3.new(1, 0, 0) end if UserInputService:IsKeyDown(Enum.KeyCode.Space) then moveDirection += Vector3.new(0, 1, 0) end if UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) then moveDirection += Vector3.new(0, -1, 0) end -- Align flight directions with where your camera is looking local cameraCFrame = camera.CFrame local lookVector = cameraCFrame.LookVector local rightVector = cameraCFrame.RightVector local direction = (lookVector * -moveDirection.Z) + (rightVector * moveDirection.X) if moveDirection.Y ~= 0 then direction = direction + Vector3.new(0, moveDirection.Y, 0) end if direction.Magnitude > 0 then bv.Velocity = direction.Unit * flySpeed else bv.Velocity = Vector3.new(0, 0, 0) end bg.CFrame = cameraCFrame task.wait() end -- Clean up objects when flying is turned off bv:Destroy() bg:Destroy() end) else humanoid.PlatformStand = false end end TextButton.MouseButton1Click:Connect(toggleFly)