Fly speed script
Key RequiredUniversal

Fly speed script

Universal Scriptmostme69mostme69 749 views 22.5K executesUpdated Oct 4, 2026
0.0/ 5(2 votes)
020% Positive
Lua Script•408 lines (13730 chars)
-- LocalScript inside StarterPlayer -> StarterPlayerScripts (PART 1)
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")

local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local camera = workspace.CurrentCamera

-- Global Flying & Noclip Configuration Variables
_G.isFlying = false
_G.isNoclip = false 
_G.flySpeed = 50
_G.maxSpeed = 500 
_G.verticalDirection = 0 -- 1 = Up, -1 = Down, 0 = Stopped

-- 1. Create Main Screen GUI Container
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "MobileFlyGui"
screenGui.ResetOnSpawn = false
screenGui.Parent = player:WaitForChild("PlayerGui")

-- 2. Main Window Frame
local mainWindow = Instance.new("Frame")
mainWindow.Size = UDim2.new(0, 190, 0, 290) 
mainWindow.Position = UDim2.new(1, -210, 0.5, -145) 
mainWindow.BackgroundColor3 = Color3.fromRGB(35, 35, 35)
mainWindow.BorderSizePixel = 0
mainWindow.ClipsDescendants = true
mainWindow.Active = true 
mainWindow.Parent = screenGui

local mainCorner = Instance.new("UICorner")
mainCorner.CornerRadius = UDim.new(0, 12)
mainCorner.Parent = mainWindow

-- 3. Top Title/Header Control Bar
local topBar = Instance.new("Frame")
topBar.Size = UDim2.new(1, 0, 0, 35) 
topBar.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
topBar.BorderSizePixel = 0
topBar.Parent = mainWindow

local topCorner = Instance.new("UICorner")
topCorner.CornerRadius = UDim.new(0, 12)
topCorner.Parent = topBar

local titleText = Instance.new("TextLabel")
titleText.Size = UDim2.new(0.4, 0, 1, 0)
titleText.Position = UDim2.new(0.05, 0, 0, 0)
titleText.BackgroundTransparency = 1
titleText.Text = "FLY CONTROLS"
titleText.TextColor3 = Color3.fromRGB(255, 255, 255)
titleText.TextSize = 11
titleText.Font = Enum.Font.SourceSansBold
titleText.TextXAlignment = Enum.TextXAlignment.Left
titleText.Parent = topBar

-- 4. Custom Mobile Action Buttons (Lock, Minimize, Close)
local lockBtn = Instance.new("TextButton")
lockBtn.Size = UDim2.new(0, 28, 0, 28)
lockBtn.Position = UDim2.new(1, -94, 0.5, -14)
lockBtn.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
lockBtn.Text = "šŸ”“" 
lockBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
lockBtn.TextSize = 14
lockBtn.Font = Enum.Font.SourceSansBold
lockBtn.Parent = topBar
local lockCorner = Instance.new("UICorner")
lockCorner.CornerRadius = UDim.new(0, 6)
lockCorner.Parent = lockBtn

local minimizeBtn = Instance.new("TextButton")
minimizeBtn.Size = UDim2.new(0, 28, 0, 28)
minimizeBtn.Position = UDim2.new(1, -62, 0.5, -14)
minimizeBtn.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
minimizeBtn.Text = "ā–¬" -- Updated minimize icon
minimizeBtn.TextColor3 = Color3.fromRGB(220, 220, 220)
minimizeBtn.TextSize = 12 -- Adjusted size slightly for the bold line icon
minimizeBtn.Font = Enum.Font.SourceSansBold
minimizeBtn.Parent = topBar
local minCorner = Instance.new("UICorner")
minCorner.CornerRadius = UDim.new(0, 6)
minCorner.Parent = minimizeBtn

local closeBtn = Instance.new("TextButton")
closeBtn.Size = UDim2.new(0, 28, 0, 28)
closeBtn.Position = UDim2.new(1, -30, 0.5, -14)
closeBtn.BackgroundColor3 = Color3.fromRGB(80, 40, 40)
closeBtn.Text = "āœ—" -- Updated close cross icon
closeBtn.TextColor3 = Color3.fromRGB(255, 100, 100)
closeBtn.TextSize = 14
closeBtn.Font = Enum.Font.SourceSansBold
closeBtn.Parent = topBar
local closeCorner = Instance.new("UICorner")
closeCorner.CornerRadius = UDim.new(0, 6)
closeCorner.Parent = closeBtn

-- 5. Content Layout Wrapper Frame
local contentFrame = Instance.new("Frame")
contentFrame.Size = UDim2.new(1, 0, 1, -35)
contentFrame.Position = UDim2.new(0, 0, 0, 35)
contentFrame.BackgroundTransparency = 1
contentFrame.Parent = mainWindow

-- 6. Main Fly Activation Button
local toggleBtn = Instance.new("TextButton")
toggleBtn.Size = UDim2.new(0.9, 0, 0, 35)
toggleBtn.Position = UDim2.new(0.05, 0, 0.03, 0)
toggleBtn.BackgroundColor3 = Color3.fromRGB(55, 55, 55)
toggleBtn.Text = "Fly: OFF"
toggleBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
toggleBtn.TextSize = 14
toggleBtn.Font = Enum.Font.SourceSansBold
toggleBtn.Parent = contentFrame
local btnCorner = Instance.new("UICorner")
btnCorner.CornerRadius = UDim.new(0, 8)
btnCorner.Parent = toggleBtn

-- Noclip Toggle Button
local noclipBtn = Instance.new("TextButton")
noclipBtn.Size = UDim2.new(0.9, 0, 0, 35)
noclipBtn.Position = UDim2.new(0.05, 0, 0.18, 0) 
noclipBtn.BackgroundColor3 = Color3.fromRGB(55, 55, 55)
noclipBtn.Text = "Noclip: OFF"
noclipBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
noclipBtn.TextSize = 14
noclipBtn.Font = Enum.Font.SourceSansBold
noclipBtn.Parent = contentFrame
local noclipCorner = Instance.new("UICorner")
noclipCorner.CornerRadius = UDim.new(0, 8)
noclipCorner.Parent = noclipBtn

-- 7. Speed Slider System
local sliderBg = Instance.new("Frame")
sliderBg.Size = UDim2.new(0.9, 0, 0, 25)
sliderBg.Position = UDim2.new(0.05, 0, 0.35, 0)
sliderBg.BackgroundColor3 = Color3.fromRGB(70, 70, 70)
sliderBg.Parent = contentFrame

local sliderCorner = Instance.new("UICorner")
sliderCorner.CornerRadius = UDim.new(0, 6)
sliderCorner.Parent = sliderBg

local sliderFill = Instance.new("Frame")
sliderFill.Size = UDim2.new(0.1, 0, 1, 0) 
sliderFill.BackgroundColor3 = Color3.fromRGB(0, 180, 100)
sliderFill.Parent = sliderBg

local fillCorner = Instance.new("UICorner")
fillCorner.CornerRadius = UDim.new(0, 6)
fillCorner.Parent = sliderFill

local speedLabel = Instance.new("TextLabel")
speedLabel.Size = UDim2.new(1, 0, 1, 0)
speedLabel.BackgroundTransparency = 1
speedLabel.Text = "Speed: " .. _G.flySpeed
speedLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
speedLabel.TextSize = 12
speedLabel.Font = Enum.Font.SourceSansBold
speedLabel.Parent = sliderBg

-- 8. Independent Vertical Control Buttons (Up / Down)
local upBtn = Instance.new("TextButton")
upBtn.Size = UDim2.new(0.42, 0, 0, 85)
upBtn.Position = UDim2.new(0.05, 0, 0.50, 0)
upBtn.BackgroundColor3 = Color3.fromRGB(60, 120, 240)
upBtn.Text = "ā–²\n\nUP"
upBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
upBtn.TextSize = 14
upBtn.Font = Enum.Font.SourceSansBold
upBtn.Parent = contentFrame
local upCorner = Instance.new("UICorner")
upCorner.CornerRadius = UDim.new(0, 8)
upCorner.Parent = upBtn

local downBtn = Instance.new("TextButton")
downBtn.Size = UDim2.new(0.42, 0, 0, 85)
downBtn.Position = UDim2.new(0.53, 0, 0.50, 0)
downBtn.BackgroundColor3 = Color3.fromRGB(220, 80, 80)
downBtn.Text = "ā–¼\n\nDOWN"
downBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
downBtn.TextSize = 14
downBtn.Font = Enum.Font.SourceSansBold
downBtn.Parent = contentFrame
local downCorner = Instance.new("UICorner")
downCorner.CornerRadius = UDim.new(0, 8)
downCorner.Parent = downBtn

-- Mobile Drag Logic
local isLocked = false
local dragging = false
local dragInput, dragStart, startPos

topBar.InputBegan:Connect(function(input)
	if not isLocked and (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
		dragging = true
		dragStart = input.Position
		startPos = mainWindow.Position
		
		input.Changed:Connect(function()
			if input.UserInputState == Enum.UserInputState.End then
				dragging = false
			end
		end)
	end
end)

UserInputService.InputChanged:Connect(function(input)
	if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
		local delta = input.Position - dragStart
		mainWindow.Position = UDim2.new(startPos.Width.Scale, startPos.Width.Offset + delta.X, startPos.Height.Scale, startPos.Height.Offset + delta.Y)
	end
end)

lockBtn.MouseButton1Click:Connect(function()
	isLocked = not isLocked
	if isLocked then
		lockBtn.Text = "šŸ”’"
		lockBtn.BackgroundColor3 = Color3.fromRGB(120, 40, 40)
	else
		lockBtn.Text = "šŸ”“"
		lockBtn.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
	end
end)
-- LocalScript inside StarterPlayer -> StarterPlayerScripts (PART 2)
local bv, bg, renderConnection

local function stopFlying()
	_G.isFlying = false
	toggleBtn.Text = "Fly: OFF"
	toggleBtn.BackgroundColor3 = Color3.fromRGB(55, 55, 55)
	
	if renderConnection then renderConnection:Disconnect() end
	if bv then bv:Destroy() end
	if bg then bg:Destroy() end
	
	character = player.Character
	if character then
		local humanoid = character:FindFirstChildOfClass("Humanoid")
		if humanoid then humanoid.PlatformStand = false end
	end
end

local function startFlying()
	character = player.Character
	if not character or not character:FindFirstChild("HumanoidRootPart") then return end
	
	local hrp = character.HumanoidRootPart
	local humanoid = character:FindFirstChildOfClass("Humanoid")
	if humanoid then humanoid.PlatformStand = true end
	
	bv = Instance.new("BodyVelocity")
	bv.MaxForce = Vector3.new(1e5, 1e5, 1e5)
	bv.Velocity = Vector3.new(0, 0, 0)
	bv.Parent = hrp
	
	bg = Instance.new("BodyGyro")
	bg.MaxTorque = Vector3.new(1e5, 1e5, 1e5)
	bg.CFrame = hrp.CFrame
	bg.Parent = hrp
	
	renderConnection = RunService.RenderStepped:Connect(function()
		if not hrp or not humanoid then return end
		
		-- 1. Noclip Loop
		if _G.isNoclip then
			for _, part in pairs(character:GetDescendants()) do
				if part:IsA("BasePart") and part.CanCollide == true then
					part.CanCollide = false
				end
			end
		end
		
		-- 2. Thumbstick Logic (Horizontal Only)
		local moveDirection = humanoid.MoveDirection
		local flatVelocity = Vector3.new(0, 0, 0)
		
		if moveDirection.Magnitude > 0 then
			local camLook = camera.CFrame.LookVector
			local flatLook = Vector3.new(camLook.X, 0, camLook.Z).Unit
			local flatRight = camera.CFrame.RightVector
			flatRight = Vector3.new(flatRight.X, 0, flatRight.Z).Unit
			
			local localMoveDirection = camera.CFrame:VectorToObjectSpace(moveDirection)
			flatVelocity = (flatLook * -localMoveDirection.Z) + (flatRight * localMoveDirection.X)
			
			if flatVelocity.Magnitude > 0 then
				flatVelocity = flatVelocity.Unit * _G.flySpeed
			end
		end
		
		-- 3. Button Logic (Vertical Only)
		local verticalVelocityY = _G.verticalDirection * _G.flySpeed
		
		bv.Velocity = Vector3.new(flatVelocity.X, verticalVelocityY, flatVelocity.Z)
		
		-- 4. Dynamic Tilt Engine (Faces camera look view)
		local camLook = camera.CFrame.LookVector
		bg.CFrame = CFrame.lookAt(hrp.Position, hrp.Position + camLook)
	end)
end

-- BUTTON TRIGGERS & INPUT EVENT BINDINGS
toggleBtn.MouseButton1Click:Connect(function()
	_G.isFlying = not _G.isFlying
	if _G.isFlying then
		toggleBtn.Text = "Fly: ON"
		toggleBtn.BackgroundColor3 = Color3.fromRGB(0, 180, 100)
		startFlying()
	else
		stopFlying()
	end
end)

-- Noclip Activation Logic
noclipBtn.MouseButton1Click:Connect(function()
	_G.isNoclip = not _G.isNoclip
	if _G.isNoclip then
		noclipBtn.Text = "Noclip: ON"
		noclipBtn.BackgroundColor3 = Color3.fromRGB(0, 180, 100)
		if not _G.isFlying then
			_G.isFlying = true
			toggleBtn.Text = "Fly: ON"
			toggleBtn.BackgroundColor3 = Color3.fromRGB(0, 180, 100)
			startFlying()
		end
	else
		noclipBtn.Text = "Noclip: OFF"
		noclipBtn.BackgroundColor3 = Color3.fromRGB(55, 55, 55)
	end
end)

-- Mobile Hold Triggers (UP Button)
upBtn.InputBegan:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
		_G.verticalDirection = 1
	end
end)
upBtn.InputEnded:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
		if _G.verticalDirection == 1 then _G.verticalDirection = 0 end
	end
end)

-- Mobile Hold Triggers (DOWN Button)
downBtn.InputBegan:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
		_G.verticalDirection = -1
	end
end)
downBtn.InputEnded:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
		if _G.verticalDirection == -1 then _G.verticalDirection = 0 end
	end
end)

-- Dynamic Slider Drag Calculations
local function updateSpeed(input)
	local relativeX = input.Position.X - sliderBg.AbsolutePosition.X
	local percentage = math.clamp(relativeX / sliderBg.AbsoluteSize.X, 0, 1)
	sliderFill.Size = UDim2.new(percentage, 0, 1, 0)
	_G.flySpeed = math.round(percentage * _G.maxSpeed)
	if _G.flySpeed < 5 then _G.flySpeed = 5 end
	speedLabel.Text = "Speed: " .. _G.flySpeed
end

local isDragging = false
sliderBg.InputBegan:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
		isDragging = true
		updateSpeed(input)
	end
end)
UserInputService.InputChanged:Connect(function(input)
	if isDragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
		updateSpeed(input)
	end
end)
UserInputService.InputEnded:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
		isDragging = false
	end
end)

-- UI Window State Handlers (Updated icons for Tween states)
local isMinimized = false
minimizeBtn.MouseButton1Click:Connect(function()
	isMinimized = not isMinimized
	if isMinimized then
		mainWindow:TweenSize(UDim2.new(0, 190, 0, 35), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true)
		minimizeBtn.Text = "ā–¢"
	else
		mainWindow:TweenSize(UDim2.new(0, 190, 0, 290), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true)
		minimizeBtn.Text = "ā–¬"
	end
end)

closeBtn.MouseButton1Click:Connect(function()
	_G.isNoclip = false
	stopFlying()
	screenGui:Destroy()
end)

player.CharacterAdded:Connect(function()
	_G.isNoclip = false
	stopFlying()
end)

Features & Information

āœˆļø Fly ⚔ Speed Control šŸŽ® Easy to Use šŸ”‘ No Key Required 🌐 Works in Supported Games šŸ–„ļø Simple UI āš™ļø Toggle Fly On/Off
#fly#speed#universal speed#no key#simple

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts