Fly by Gemini PRO
Key RequiredUniversal

Fly by Gemini PRO

Universal ScriptHelloboyHelloboy 586 views 1.1K executesUpdated Dec 18, 2025
0.0/ 5(5 votes)
050% Positive
Lua Script•144 lines (4566 chars)
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local ContextActionService = game:GetService("ContextActionService")

local player = Players.LocalPlayer
local camera = workspace.CurrentCamera

-- Configuration
local FLY_SPEED = 50
local FLY_BUTTON_NAME = "ToggleFly"

-- State
local isFlying = false
local bodyGyro
local bodyVelocity

-- UI Setup (Creates a button for Mobile/PC)
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "FlyGui"
screenGui.ResetOnSpawn = false
screenGui.Parent = player:WaitForChild("PlayerGui")

local flyButton = Instance.new("TextButton")
flyButton.Name = "FlyButton"
flyButton.Size = UDim2.new(0, 100, 0, 50)
flyButton.Position = UDim2.new(0.8, -10, 0.7, -10) -- Bottom right, above jump button
flyButton.AnchorPoint = Vector2.new(1, 1)
flyButton.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
flyButton.TextColor3 = Color3.new(1, 1, 1)
flyButton.TextScaled = true
flyButton.Text = "FLY: OFF"
flyButton.Font = Enum.Font.GothamBold
flyButton.Parent = screenGui
-- Rounds the corners for a better look
local uiCorner = Instance.new("UICorner")
uiCorner.CornerRadius = UDim.new(0, 10)
uiCorner.Parent = flyButton

-- Helper Functions
local function getCharacter()
	return player.Character or player.CharacterAdded:Wait()
end

local function getRoot(character)
	return character:WaitForChild("HumanoidRootPart")
end

local function getHumanoid(character)
	return character:WaitForChild("Humanoid")
end

-- Toggle Flight Function
local function toggleFlight()
	isFlying = not isFlying
	
	local character = getCharacter()
	local root = getRoot(character)
	local humanoid = getHumanoid(character)

	if isFlying then
		flyButton.Text = "FLY: ON"
		flyButton.BackgroundColor3 = Color3.fromRGB(0, 255, 100)
		
		-- Disable default physics roughly
		humanoid.PlatformStand = true 
		
		-- Create Flight Forces
		bodyGyro = Instance.new("BodyGyro")
		bodyGyro.P = 9e4
		bodyGyro.MaxTorque = Vector3.new(9e9, 9e9, 9e9)
		bodyGyro.CFrame = root.CFrame
		bodyGyro.Parent = root
		
		bodyVelocity = Instance.new("BodyVelocity")
		bodyVelocity.Velocity = Vector3.new(0, 0, 0)
		bodyVelocity.MaxForce = Vector3.new(9e9, 9e9, 9e9)
		bodyVelocity.Parent = root
		
	else
		flyButton.Text = "FLY: OFF"
		flyButton.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
		
		humanoid.PlatformStand = false
		
		-- Destroy forces
		if bodyGyro then bodyGyro:Destroy() end
		if bodyVelocity then bodyVelocity:Destroy() end
	end
end

-- Flight Physics Loop
RunService.RenderStepped:Connect(function()
	if isFlying then
		local character = getCharacter()
		if character and bodyGyro and bodyVelocity then
			local root = getRoot(character)
			local humanoid = getHumanoid(character)
			
			-- Rotate character to look where the camera looks
			bodyGyro.CFrame = camera.CFrame
			
			-- Calculate velocity based on MoveDirection (Works for WASD + Mobile Stick)
			-- We map the MoveDirection (relative to character) to the Camera's CFrame
			local moveDir = humanoid.MoveDirection
			
			-- If the player is giving input (moveDir is not 0,0,0)
			if moveDir.Magnitude > 0 then
				-- We multiply the Camera's LookVector by speed
				-- However, Humanoid.MoveDirection is flattened on the Y axis usually. 
				-- To fly UP/DOWN based on Camera pitch, we use the Camera's vectors directly.
				
				local travelVector = (camera.CFrame.RightVector * ((moveDir.X * moveDir.X > 0.01 and (moveDir.X > 0 and 1 or -1)) or 0)) 
                    + (camera.CFrame.LookVector * ((moveDir.Z * moveDir.Z > 0.01 and (moveDir.Z < 0 and 1 or -1)) or 0))

				-- Simplification: Just allow the camera look vector to dictate forward movement
				-- The Humanoid.MoveDirection is already relative to the camera in 'ShiftLock' or First Person, 
				-- but in standard mode, we want "Forward" input to mean "Go where camera looks".
				
				bodyVelocity.Velocity = camera.CFrame.LookVector * (moveDir.Magnitude * FLY_SPEED)
			else
				bodyVelocity.Velocity = Vector3.new(0, 0, 0)
			end
		end
	end
end)

-- Connect Input
flyButton.MouseButton1Click:Connect(toggleFlight)

-- Optional: Keyboard Shortcut (F key)
UserInputService.InputBegan:Connect(function(input, gameProcessed)
	if gameProcessed then return end
	if input.KeyCode == Enum.KeyCode.F then
		toggleFlight()
	end
end)

-- Cleanup on respawn to prevent errors
player.CharacterRemoving:Connect(function()
	isFlying = false
	flyButton.Text = "FLY: OFF"
	flyButton.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
end)

Features & Information

It's mobile, PC, and controller compatible there's aa button which you click and yo get to fly also you can only fly forwards
#Fly#Gui#Script#Gemini

Community Comments (4)

"Gemini pro" there is no such thing as a real programmer anymore AI killed it 💔😭

Ratman39828Ratman39828Dec 18, 2025

* * ai

Ratman39828Ratman39828Dec 18, 2025

Rat man isn't happy

Ratman39828Ratman39828Dec 18, 2025

L ai

More Scripts for Universal Scripts