fly gui made by grok Ai
Key RequiredUniversal

fly gui made by grok Ai

Universal ScriptNPCNOkNPCNOk 10.1K views 50 executesUpdated Nov 3, 2025
1.7/ 5(3 votes)
1233% Positive
Lua Script•302 lines (10060 chars)
--[[
	ULTRA-SMOOTH JOYSTICK + SMOOTH DRAG + FLY + UP/DOWN
	100% MOBILE GOD-TIER
--]]

local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")

local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local camera = workspace.CurrentCamera

--------------------------------------------------------------------
-- 1. SMOOTH DRAGGABLE FLY BUTTON (UNCHANGED FROM LAST)
--------------------------------------------------------------------
local flyGui = Instance.new("ScreenGui")
flyGui.ResetOnSpawn = false
flyGui.Parent = playerGui

local flyFrame = Instance.new("Frame")
flyFrame.Size = UDim2.new(0, 120, 0, 60)
flyFrame.Position = UDim2.new(0.05, 0, 0.8, 0)
flyFrame.BackgroundColor3 = Color3.fromRGB(20, 20, 30)
flyFrame.BorderSizePixel = 0
flyFrame.Active = true
flyFrame.Parent = flyGui

local flyCorner = Instance.new("UICorner")
flyCorner.CornerRadius = UDim.new(0, 16)
flyCorner.Parent = flyFrame

local flyButton = Instance.new("TextButton")
flyButton.Size = UDim2.new(1, -16, 1, -16)
flyButton.Position = UDim2.new(0, 8, 0, 8)
flyButton.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
flyButton.Text = "FLY OFF"
flyButton.TextColor3 = Color3.new(1,1,1)
flyButton.Font = Enum.Font.GothamBold
flyButton.TextScaled = true
flyButton.Parent = flyFrame

local btnCorner = Instance.new("UICorner")
btnCorner.CornerRadius = UDim.new(0, 12)
btnCorner.Parent = flyButton

-- SMOOTH DRAG (kept from last version)
local dragging = false
local targetPos = flyFrame.Position
local currentPos = flyFrame.Position
local velocity = Vector2.new()
local lastInputPos = nil
local inputConnection = nil
local SMOOTHING = 0.12
local INERTIA = 0.9

local function updateDrag()
	local delta = targetPos - currentPos
	velocity = velocity + (delta * Vector2.new(1,1)) * 20
	velocity = velocity * INERTIA
	currentPos = currentPos + velocity * RunService.Heartbeat:Wait()
	flyFrame.Position = UDim2.new(0, currentPos.X.Offset, 0, currentPos.Y.Offset)
end

flyFrame.InputBegan:Connect(function(input)
	if input.UserInputType ~= Enum.UserInputType.Touch or dragging then return end
	dragging = true
	lastInputPos = input.Position
	targetPos = flyFrame.Position
	velocity = Vector2.new()
	TweenService:Create(flyFrame, TweenInfo.new(0.1), {Size = UDim2.new(0, 130, 0, 70)}):Play()

	inputConnection = RunService.Heartbeat:Connect(function()
		if not lastInputPos then return end
		local current = input.Position
		local delta = current - lastInputPos
		targetPos = UDim2.new(
			targetPos.X.Scale, targetPos.X.Offset + delta.X,
			targetPos.Y.Scale, targetPos.Y.Offset + delta.Y
		)
		lastInputPos = current
	end)
end)

flyFrame.InputEnded:Connect(function()
	if not dragging then return end
	dragging = false
	lastInputPos = nil
	if inputConnection then inputConnection:Disconnect() end
	TweenService:Create(flyFrame, TweenInfo.new(0.2, Enum.EasingStyle.Back), {Size = UDim2.new(0, 120, 0, 60)}):Play()
end)

RunService.RenderStepped:Connect(updateDrag)

--------------------------------------------------------------------
-- 2. ULTRA-SMOOTH JOYSTICK (NEW!)
--------------------------------------------------------------------
local joyGui = Instance.new("ScreenGui")
joyGui.ResetOnSpawn = false
joyGui.Parent = playerGui

local joyBase = Instance.new("Frame")
joyBase.Size = UDim2.new(0, 130, 0, 130)
joyBase.Position = UDim2.new(0, 20, 1, -150)
joyBase.BackgroundColor3 = Color3.fromRGB(40, 40, 50)
joyBase.BackgroundTransparency = 0.6
joyBase.Parent = joyGui

local baseCorner = Instance.new("UICorner")
baseCorner.CornerRadius = UDim.new(1, 0)
baseCorner.Parent = joyBase

local joyKnob = Instance.new("Frame")
joyKnob.Size = UDim2.new(0, 50, 0, 50)
joyKnob.Position = UDim2.new(0.5, -25, 0.5, -25)
joyKnob.BackgroundColor3 = Color3.fromRGB(0, 200, 255)
joyKnob.Parent = joyBase

local knobCorner = Instance.new("UICorner")
knobCorner.CornerRadius = UDim.new(1, 0)
knobCorner.Parent = joyKnob

-- SMOOTH JOYSTICK STATE
local joyTarget = Vector2.new()  -- Target input (-1 to 1)
local joyCurrent = Vector2.new() -- Smoothed input
local joyActive = false
local joyRadius = 65
local JOY_SMOOTH = 0.15  -- Lower = smoother, slower response

-- Update knob visually with smooth tween
local function updateKnobVisual(dir, dist)
	local targetPos = UDim2.new(0.5, dir.X * dist - 25, 0.5, dir.Y * dist - 25)
	joyKnob:TweenPosition(targetPos, "Out", "Quad", 0.08, true)
end

-- Get input from touch
local currentTouch = nil

joyBase.InputBegan:Connect(function(input)
	if input.UserInputType ~= Enum.UserInputType.Touch or joyActive then return end
	joyActive = true
	currentTouch = input
end)

joyBase.InputChanged:Connect(function(input)
	if not joyActive or input ~= currentTouch then return end
	local center = joyBase.AbsolutePosition + joyBase.AbsoluteSize * 0.5
	local delta = Vector2.new(input.Position.X, input.Position.Y) - center
	local dist = math.min(delta.Magnitude, joyRadius)
	local dir = if dist > 0 then delta.Unit else Vector2.new()

	joyTarget = dir * (dist / joyRadius)
	updateKnobVisual(dir, dist)
end)

joyBase.InputEnded:Connect(function(input)
	if not joyActive or input ~= currentTouch then return end
	joyActive = false
	currentTouch = nil
	joyTarget = Vector2.new()
	updateKnobVisual(Vector2.new(), 0)
end)

-- SMOOTH JOYSTICK INPUT EVERY FRAME
RunService.RenderStepped:Connect(function()
	if not joyActive then
		-- Smooth return to zero
		joyCurrent = joyCurrent:Lerp(Vector2.new(), JOY_SMOOTH)
	else
		-- Smooth follow target
		joyCurrent = joyCurrent:Lerp(joyTarget, JOY_SMOOTH)
	end
end)

--------------------------------------------------------------------
-- 3. UP / DOWN BUTTONS
--------------------------------------------------------------------
local udGui = Instance.new("ScreenGui")
udGui.ResetOnSpawn = false
udGui.Parent = playerGui

local upButton = Instance.new("TextButton")
upButton.Size = UDim2.new(0, 70, 0, 70)
upButton.Position = UDim2.new(1, -90, 1, -160)
upButton.BackgroundColor3 = Color3.fromRGB(0, 200, 100)
upButton.Text = "Up"
upButton.TextColor3 = Color3.new(1,1,1)
upButton.Font = Enum.Font.GothamBold
upButton.TextScaled = true
upButton.Parent = udGui

local upCorner = Instance.new("UICorner")
upCorner.CornerRadius = UDim.new(1, 0)
upCorner.Parent = upButton

local downButton = Instance.new("TextButton")
downButton.Size = UDim2.new(0, 70, 0, 70)
downButton.Position = UDim2.new(1, -90, 1, -80)
downButton.BackgroundColor3 = Color3.fromRGB(255, 100, 100)
downButton.Text = "Down"
downButton.TextColor3 = Color3.new(1,1,1)
downButton.Font = Enum.Font.GothamBold
downButton.TextScaled = true
downButton.Parent = udGui

local downCorner = Instance.new("UICorner")
downCorner.CornerRadius = UDim.new(1, 0)
downCorner.Parent = downButton

local upPressed = false
local downPressed = false
local verticalSpeed = 60

upButton.MouseButton1Down:Connect(function() upPressed = true end)
upButton.MouseButton1Up:Connect(function() upPressed = false end)
downButton.MouseButton1Down:Connect(function() downPressed = true end)
downButton.MouseButton1Up:Connect(function() downPressed = false end)

--------------------------------------------------------------------
-- 4. FLY SYSTEM
--------------------------------------------------------------------
local flying = false
local flySpeed = 70
local bodyGyro, bodyVelocity

local function startFlying()
	if flying then return end
	flying = true
	flyButton.Text = "FLY ON"
	flyButton.BackgroundColor3 = Color3.fromRGB(0, 255, 100)

	local char = player.Character or player.CharacterAdded:Wait()
	local root = char:WaitForChild("HumanoidRootPart")
	local hum = char:WaitForChild("Humanoid")
	hum.PlatformStand = true

	bodyGyro = Instance.new("BodyGyro")
	bodyGyro.P = 9000
	bodyGyro.MaxTorque = Vector3.new(9e9, 9e9, 9e9)
	bodyGyro.CFrame = root.CFrame
	bodyGyro.Parent = root

	bodyVelocity = Instance.new("BodyVelocity")
	bodyVelocity.Velocity = Vector3.zero
	bodyVelocity.MaxForce = Vector3.new(9e9, 9e9, 9e9)
	bodyVelocity.Parent = root
end

local function stopFlying()
	if not flying then return end
	flying = false
	flyButton.Text = "FLY OFF"
	flyButton.BackgroundColor3 = Color3.fromRGB(0, 170, 255)

	if bodyGyro then bodyGyro:Destroy() end
	if bodyVelocity then bodyVelocity:Destroy() end

	local hum = player.Character and player.Character:FindFirstChild("Humanoid")
	if hum then hum.PlatformStand = false end
end

flyButton.MouseButton1Click:Connect(function()
	if flying then stopFlying() else startFlying() end
end)

--------------------------------------------------------------------
-- 5. MOVEMENT (USING SMOOTHED JOYSTICK INPUT)
--------------------------------------------------------------------
RunService.RenderStepped:Connect(function()
	if not flying or not player.Character or not player.Character:FindFirstChild("HumanoidRootPart") then return end

	local root = player.Character.HumanoidRootPart
	local move = Vector3.new(joyCurrent.X, 0, -joyCurrent.Y)  -- SMOOTHED INPUT

	if move.Magnitude > 0.05 then
		local forward = camera.CFrame.LookVector
		local right = camera.CFrame.RightVector
		local worldMove = (forward * move.Z + right * move.X) * flySpeed
		bodyVelocity.Velocity = Vector3.new(worldMove.X, bodyVelocity.Velocity.Y, worldMove.Z)
	else
		bodyVelocity.Velocity = Vector3.new(0, bodyVelocity.Velocity.Y, 0)
	end

	local vertical = 0
	if upPressed then vertical += verticalSpeed end
	if downPressed then vertical -= verticalSpeed end
	if vertical == 0 and math.abs(bodyVelocity.Velocity.Y) < 1 then
		bodyVelocity.Velocity = Vector3.new(bodyVelocity.Velocity.X, 0.2, bodyVelocity.Velocity.Z)
	else
		bodyVelocity.Velocity = Vector3.new(bodyVelocity.Velocity.X, vertical, bodyVelocity.Velocity.Z)
	end

	bodyGyro.CFrame = camera.CFrame
end)

--------------------------------------------------------------------
-- 6. CLEANUP
--------------------------------------------------------------------
player.CharacterAdded:Connect(function()
	if flying then stopFlying() end
end)

Features & Information

idk

Community Comments (2)

RobinsonFRobinsonFNov 4, 2025

@baobaonghiengame200 one of the cleanest “FLY GUI” i have ever seen excellent job!!:)

Replying to @RobinsonF
NPCNOkNPCNOkNov 4, 2025(edited)

@RobinsonF thanks to Grok because he is fast and cooking

More Scripts for Universal Scripts