-- Universal Fly Script (Mobile Optimized & Precision Fixed) local Players = game:GetService("Players") local RunService = game:GetService("RunService") local CoreGui = game:GetService("CoreGui") local UserInputService = game:GetService("UserInputService") local TweenService = game:GetService("TweenService") local player = Players.LocalPlayer local camera = workspace.CurrentCamera -- 1. CLEANUP PREVIOUS RUNS if CoreGui:FindFirstChild("VehicleFlyGui") then CoreGui.VehicleFlyGui:Destroy() end -- 2. CREATE THE GUI local screenGui = Instance.new("ScreenGui") screenGui.Name = "VehicleFlyGui" screenGui.ResetOnSpawn = false screenGui.ZIndexBehavior = Enum.ZIndexBehavior.Global screenGui.Parent = CoreGui -- --- MAIN FLY UI (TRANSPARENT) --- local mainFrame = Instance.new("Frame") mainFrame.Size = UDim2.new(0, 180, 0, 160) mainFrame.Position = UDim2.new(0.5, -90, 0.3, 0) mainFrame.BackgroundColor3 = Color3.fromRGB(100, 100, 100) mainFrame.BackgroundTransparency = 0.4 mainFrame.BorderSizePixel = 0 mainFrame.Active = true mainFrame.ClipsDescendants = false mainFrame.ZIndex = 10 mainFrame.Parent = screenGui local mainCorner = Instance.new("UICorner") mainCorner.CornerRadius = UDim.new(0, 10) mainCorner.Parent = mainFrame local titleLabel = Instance.new("TextLabel") titleLabel.Size = UDim2.new(1, -35, 0, 35) titleLabel.BackgroundTransparency = 1 titleLabel.Text = "Vfly 1.3" titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255) titleLabel.Font = Enum.Font.SourceSansBold titleLabel.TextSize = 22 titleLabel.ZIndex = 11 titleLabel.Parent = mainFrame local minimizeButton = Instance.new("TextButton") minimizeButton.Size = UDim2.new(0, 35, 0, 35) minimizeButton.Position = UDim2.new(1, -35, 0, 0) minimizeButton.BackgroundTransparency = 1 minimizeButton.Text = "-" minimizeButton.TextColor3 = Color3.fromRGB(255, 255, 255) minimizeButton.Font = Enum.Font.SourceSansBold minimizeButton.TextSize = 24 minimizeButton.ZIndex = 11 minimizeButton.Parent = mainFrame local minusButton = Instance.new("TextButton") minusButton.Size = UDim2.new(0, 45, 0, 45) minusButton.Position = UDim2.new(0, 15, 0, 40) minusButton.BackgroundColor3 = Color3.fromRGB(80, 80, 80) minusButton.BackgroundTransparency = 0.2 minusButton.Text = "-" minusButton.TextColor3 = Color3.fromRGB(255, 255, 255) minusButton.Font = Enum.Font.SourceSansBold minusButton.TextSize = 28 minusButton.ZIndex = 11 minusButton.Parent = mainFrame Instance.new("UICorner", minusButton).CornerRadius = UDim.new(0, 8) local speedBox = Instance.new("TextBox") speedBox.Size = UDim2.new(0, 60, 0, 45) speedBox.Position = UDim2.new(0, 60, 0, 40) speedBox.BackgroundTransparency = 1 speedBox.Text = "3" speedBox.TextColor3 = Color3.fromRGB(255, 255, 255) speedBox.Font = Enum.Font.SourceSansBold speedBox.TextSize = 26 speedBox.ClearTextOnFocus = false speedBox.ZIndex = 11 speedBox.Parent = mainFrame local plusButton = Instance.new("TextButton") plusButton.Size = UDim2.new(0, 45, 0, 45) plusButton.Position = UDim2.new(0, 120, 0, 40) plusButton.BackgroundColor3 = Color3.fromRGB(80, 80, 80) plusButton.BackgroundTransparency = 0.2 plusButton.Text = "+" plusButton.TextColor3 = Color3.fromRGB(255, 255, 255) plusButton.Font = Enum.Font.SourceSansBold plusButton.TextSize = 28 plusButton.ZIndex = 11 plusButton.Parent = mainFrame Instance.new("UICorner", plusButton).CornerRadius = UDim.new(0, 8) local flyButton = Instance.new("TextButton") flyButton.Size = UDim2.new(1, -30, 0, 40) flyButton.Position = UDim2.new(0, 15, 0, 100) flyButton.BackgroundColor3 = Color3.fromRGB(70, 70, 70) flyButton.BackgroundTransparency = 0.2 flyButton.Text = "Fly" flyButton.TextColor3 = Color3.fromRGB(255, 255, 255) flyButton.Font = Enum.Font.SourceSansBold flyButton.TextSize = 22 flyButton.ZIndex = 11 flyButton.Parent = mainFrame Instance.new("UICorner", flyButton).CornerRadius = UDim.new(0, 8) -- --- SIDE MENU (MATCHING TRANSPARENCY) --- local sideMenuFrame = Instance.new("Frame") sideMenuFrame.Size = UDim2.new(0, 160, 1, 0) sideMenuFrame.Position = UDim2.new(0, 0, 0, 0) sideMenuFrame.BackgroundColor3 = Color3.fromRGB(100, 100, 100) sideMenuFrame.BackgroundTransparency = 0.4 sideMenuFrame.BorderSizePixel = 0 sideMenuFrame.ZIndex = 5 sideMenuFrame.Visible = false sideMenuFrame.Parent = mainFrame Instance.new("UICorner", sideMenuFrame).CornerRadius = UDim.new(0, 10) -- Toggle Button for Side Menu (SOLID / OPAQUE) local menuToggleButton = Instance.new("TextButton") menuToggleButton.Size = UDim2.new(0, 25, 0, 40) menuToggleButton.Position = UDim2.new(1, -5, 0.5, -20) menuToggleButton.BackgroundColor3 = Color3.fromRGB(75, 75, 75) menuToggleButton.BackgroundTransparency = 0 menuToggleButton.TextColor3 = Color3.fromRGB(255, 255, 255) menuToggleButton.Text = ">" menuToggleButton.TextSize = 16 menuToggleButton.Font = Enum.Font.SourceSansBold menuToggleButton.ZIndex = 12 menuToggleButton.Parent = mainFrame Instance.new("UICorner", menuToggleButton).CornerRadius = UDim.new(0, 6) local uiListLayout = Instance.new("UIListLayout") uiListLayout.Padding = UDim.new(0, 8) uiListLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center uiListLayout.VerticalAlignment = Enum.VerticalAlignment.Center uiListLayout.Parent = sideMenuFrame -- Control Variables local canLookUpDown = true local isDirectionLocked = false local lockedLookVector = Vector3.new(0, 0, -1) local rotationOffsetY = 0 local lookToggleBtn = Instance.new("TextButton") lookToggleBtn.Size = UDim2.new(0, 140, 0, 35) lookToggleBtn.BackgroundColor3 = Color3.fromRGB(50, 150, 50) lookToggleBtn.BackgroundTransparency = 0.2 lookToggleBtn.TextColor3 = Color3.fromRGB(255, 255, 255) lookToggleBtn.Text = "Look Up/Down: ON" lookToggleBtn.Font = Enum.Font.SourceSansBold lookToggleBtn.TextSize = 14 lookToggleBtn.ZIndex = 6 lookToggleBtn.Parent = sideMenuFrame Instance.new("UICorner", lookToggleBtn).CornerRadius = UDim.new(0, 6) local directionLockBtn = Instance.new("TextButton") directionLockBtn.Size = UDim2.new(0, 140, 0, 35) directionLockBtn.BackgroundColor3 = Color3.fromRGB(180, 50, 50) directionLockBtn.BackgroundTransparency = 0.2 directionLockBtn.TextColor3 = Color3.fromRGB(255, 255, 255) directionLockBtn.Text = "Lock Direction: OFF" directionLockBtn.Font = Enum.Font.SourceSansBold directionLockBtn.TextSize = 14 directionLockBtn.ZIndex = 6 directionLockBtn.Parent = sideMenuFrame Instance.new("UICorner", directionLockBtn).CornerRadius = UDim.new(0, 6) local rotateBtn = Instance.new("TextButton") rotateBtn.Size = UDim2.new(0, 140, 0, 35) rotateBtn.BackgroundColor3 = Color3.fromRGB(80, 80, 80) rotateBtn.BackgroundTransparency = 0.2 rotateBtn.TextColor3 = Color3.fromRGB(255, 255, 255) rotateBtn.Text = "Rotate Y (+45°)" rotateBtn.Font = Enum.Font.SourceSansBold rotateBtn.TextSize = 14 rotateBtn.ZIndex = 6 rotateBtn.Parent = sideMenuFrame Instance.new("UICorner", rotateBtn).CornerRadius = UDim.new(0, 6) -- --- LOGIC & CONNECTIONS --- -- Side Menu Toggle Function local menuOpen = false local function toggleSideMenu(forceClose) if forceClose then menuOpen = false else menuOpen = not menuOpen end if menuOpen then sideMenuFrame.Visible = true end local targetPosition = menuOpen and UDim2.new(1, 10, 0, 0) or UDim2.new(0, 0, 0, 0) local targetText = menuOpen and "<" or ">" local tween = TweenService:Create(sideMenuFrame, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Position = targetPosition}) tween:Play() if not menuOpen then tween.Completed:Connect(function() if not menuOpen then sideMenuFrame.Visible = false end end) end menuToggleButton.Text = targetText end menuToggleButton.Activated:Connect(function() toggleSideMenu() end) -- Feature Button Actions lookToggleBtn.Activated:Connect(function() canLookUpDown = not canLookUpDown if canLookUpDown then lookToggleBtn.Text = "Look Up/Down: ON" lookToggleBtn.BackgroundColor3 = Color3.fromRGB(50, 150, 50) else lookToggleBtn.Text = "Look Up/Down: OFF" lookToggleBtn.BackgroundColor3 = Color3.fromRGB(180, 50, 50) end end) directionLockBtn.Activated:Connect(function() isDirectionLocked = not isDirectionLocked if isDirectionLocked then lockedLookVector = camera.CFrame.LookVector directionLockBtn.Text = "Lock Direction: ON" directionLockBtn.BackgroundColor3 = Color3.fromRGB(50, 150, 50) else directionLockBtn.Text = "Lock Direction: OFF" directionLockBtn.BackgroundColor3 = Color3.fromRGB(180, 50, 50) end end) rotateBtn.Activated:Connect(function() rotationOffsetY = (rotationOffsetY + 45) % 360 local char = player.Character if char and not isFlying then local hum = char:FindFirstChildOfClass("Humanoid") local target = (hum and hum.SeatPart) or char:FindFirstChild("HumanoidRootPart") if target then target.CFrame = target.CFrame * CFrame.Angles(0, math.rad(45), 0) end end end) -- Mobile Drag Logic local dragging, dragInput, dragStart, startPos mainFrame.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true dragStart = input.Position startPos = mainFrame.Position input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then dragging = false end end) end end) mainFrame.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 local delta = input.Position - dragStart mainFrame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y) end end) -- Minimize Logic local isMinimized = false minimizeButton.Activated:Connect(function() isMinimized = not isMinimized if isMinimized then toggleSideMenu(true) mainFrame.Size = UDim2.new(0, 180, 0, 35) minimizeButton.Text = "+" menuToggleButton.Visible = false minusButton.Visible = false plusButton.Visible = false speedBox.Visible = false flyButton.Visible = false else mainFrame.Size = UDim2.new(0, 180, 0, 160) minimizeButton.Text = "-" menuToggleButton.Visible = true minusButton.Visible = true plusButton.Visible = true speedBox.Visible = true flyButton.Visible = true end end) -- Universal Flight Logic local isFlying = false local flySpeed = 3 local bodyVelocity = nil local bodyGyro = nil local loopConnection = nil -- FIXED FLOATING POINT PRECISION HELPER local function formatSpeed(speed) -- Rounds the number to exactly 3 decimal places (e.g. 0.5500002 becomes 0.55) return math.round(speed * 1000) / 1000 end local function toggleFlight() local char = player.Character if not char then return end local hum = char:FindFirstChildOfClass("Humanoid") local hrp = char:FindFirstChild("HumanoidRootPart") if not hum or not hrp then return end local targetPart = hum.SeatPart and hum.SeatPart:IsA("VehicleSeat") and hum.SeatPart or hrp if not isFlying then isFlying = true flyButton.Text = "Unfly" flyButton.BackgroundColor3 = Color3.fromRGB(180, 50, 50) bodyVelocity = Instance.new("BodyVelocity") bodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge) bodyVelocity.Velocity = Vector3.new(0, 0, 0) bodyVelocity.Parent = targetPart bodyGyro = Instance.new("BodyGyro") bodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge) bodyGyro.CFrame = targetPart.CFrame bodyGyro.Parent = targetPart local PlayerModule = require(player.PlayerScripts:WaitForChild("PlayerModule")) local controls = PlayerModule:GetControls() loopConnection = RunService.RenderStepped:Connect(function() if not targetPart or not targetPart.Parent or not bodyVelocity or not bodyGyro then if isFlying then toggleFlight() end return end local moveDirection = Vector3.new(0, 0, 0) local rawInput = controls:GetMoveVector() if rawInput.Magnitude > 0 then local camCFrame = camera.CFrame local look = camCFrame.LookVector * -rawInput.Z local side = camCFrame.RightVector * rawInput.X moveDirection = (look + side).Unit end bodyVelocity.Velocity = moveDirection * (flySpeed * 25) local baseLook = isDirectionLocked and lockedLookVector or camera.CFrame.LookVector if not canLookUpDown then baseLook = Vector3.new(baseLook.X, 0, baseLook.Z) if baseLook.Magnitude < 0.01 then baseLook = Vector3.new(0, 0, -1) end end local customOffset = CFrame.Angles(0, math.rad(rotationOffsetY), 0) bodyGyro.CFrame = CFrame.lookAt(targetPart.Position, targetPart.Position + baseLook) * customOffset end) else isFlying = false flyButton.Text = "Fly" flyButton.BackgroundColor3 = Color3.fromRGB(70, 70, 70) if loopConnection then loopConnection:Disconnect() end if bodyVelocity then bodyVelocity:Destroy() end if bodyGyro then bodyGyro:Destroy() end end end -- FIXED SPEED BUTTONS plusButton.Activated:Connect(function() flySpeed = formatSpeed(flySpeed + 1) speedBox.Text = tostring(flySpeed) end) minusButton.Activated:Connect(function() flySpeed = formatSpeed(flySpeed - 1) speedBox.Text = tostring(flySpeed) end) speedBox.FocusLost:Connect(function() local typedSpeed = tonumber(speedBox.Text) if typedSpeed then flySpeed = formatSpeed(typedSpeed) end -- This forces the box back to the real number if they type letters by accident speedBox.Text = tostring(flySpeed) end) flyButton.Activated:Connect(function() toggleFlight() end)