local player, character, humanoid, HRP, flySpeed, flying, bodyVelocity, bodyGyro, TweenService, RunService, Camera, screenGui, loadingFrame, loadingLabel, flyControlsContainer, dpadSize, toggleButton, forwardButton, backButton, leftButton, rightButton, upButton, downButton, uiToggleButton, uiVisible, inputFlags player = game.Players.LocalPlayer character = player.Character or player.CharacterAdded:Wait() humanoid = character:WaitForChild("Humanoid") HRP = character:WaitForChild("HumanoidRootPart") flySpeed = 50 flying = false bodyVelocity = Instance.new("BodyVelocity") bodyVelocity.Velocity = Vector3.new(0, 0, 0) bodyVelocity.MaxForce = Vector3.new(100000, 100000, 100000) bodyGyro = Instance.new("BodyGyro") bodyGyro.CFrame = HRP.CFrame bodyGyro.MaxTorque = Vector3.new(100000, 100000, 100000) TweenService = game:GetService("TweenService") RunService = game:GetService("RunService") Camera = workspace.CurrentCamera screenGui = Instance.new("ScreenGui") screenGui.Name = "FlyScreenGui" screenGui.ResetOnSpawn = false screenGui.Parent = player:WaitForChild("PlayerGui") loadingFrame = Instance.new("Frame") loadingFrame.Name = "LoadingFrame" loadingFrame.Size = UDim2.new(1, 0, 1, 0) loadingFrame.Position = UDim2.new(0, 0, 0, 0) loadingFrame.BackgroundColor3 = Color3.fromRGB(0, 0, 0) loadingFrame.BackgroundTransparency = 0 loadingFrame.Parent = screenGui loadingLabel = Instance.new("TextLabel") loadingLabel.Name = "LoadingLabel" loadingLabel.Size = UDim2.new(0.5, 0, 0.2, 0) loadingLabel.Position = UDim2.new(0.25, 0, 0.4, 0) loadingLabel.BackgroundTransparency = 1 loadingLabel.Text = "Loading..." loadingLabel.TextScaled = true loadingLabel.Font = Enum.Font.GothamBold loadingLabel.TextColor3 = Color3.fromRGB(255, 255, 255) loadingLabel.Parent = loadingFrame flyControlsContainer = Instance.new("Frame") flyControlsContainer.Name = "FlyControlsContainer" flyControlsContainer.Size = UDim2.new(1, 0, 1, 0) flyControlsContainer.BackgroundTransparency = 1 flyControlsContainer.Parent = screenGui dpadSize = UDim2.new(0, 60, 0, 60) toggleButton = nil forwardButton = nil backButton = nil leftButton = nil rightButton = nil upButton = nil downButton = nil uiToggleButton = nil uiVisible = true inputFlags = { forward = false, back = false, left = false, right = false, up = false, down = false } local function startFlying() flying = true bodyVelocity.Parent = HRP bodyGyro.Parent = HRP humanoid.PlatformStand = true end local function stopFlying() flying = false bodyVelocity.Parent = nil bodyGyro.Parent = nil humanoid.PlatformStand = false end local function createButton(parent, name, text, pos, size) local btn = Instance.new("TextButton") btn.Name = name btn.Text = text btn.Size = size btn.Position = pos btn.BackgroundColor3 = Color3.fromRGB(40, 40, 40) btn.TextColor3 = Color3.fromRGB(255, 255, 255) btn.Font = Enum.Font.GothamBold btn.TextScaled = true btn.BackgroundTransparency = 0.2 btn.Parent = parent local corner = Instance.new("UICorner") corner.CornerRadius = UDim.new(0, 12) corner.Parent = btn return btn end local function tweenFlyControls(visible) local tweenTime = 0.5 for _, btn in pairs(flyControlsContainer:GetChildren()) do if btn:IsA("TextButton") then local targetBackgroundTransparency = visible and 0.2 or 1 local targetTextTransparency = visible and 0 or 1 local tweenInfo = TweenInfo.new(tweenTime, Enum.EasingStyle.Quad, Enum.EasingDirection.Out) local tween = TweenService:Create(btn, tweenInfo, { BackgroundTransparency = targetBackgroundTransparency, TextTransparency = targetTextTransparency }) tween:Play() -- Désactiver les clics quand invisible btn.Active = visible btn.Selectable = visible end end end local function addTouchEvents(button, flagName) button.MouseButton1Down:Connect(function() inputFlags[flagName] = true end) button.MouseButton1Up:Connect(function() inputFlags[flagName] = false end) button.MouseLeave:Connect(function() inputFlags[flagName] = false end) end toggleButton = createButton(flyControlsContainer, "ToggleFlyButton", "Toggle Fly", UDim2.new(1, -110, 0, 10), UDim2.new(0, 100, 0, 50)) toggleButton.MouseButton1Click:Connect(function() if flying then stopFlying() toggleButton.Text = "Fly OFF" else startFlying() toggleButton.Text = "Fly ON" end end) forwardButton = createButton(flyControlsContainer, "ForwardButton", "↑", UDim2.new(0, 70, 1, -190), dpadSize) backButton = createButton(flyControlsContainer, "BackButton", "↓", UDim2.new(0, 70, 1, -70), dpadSize) leftButton = createButton(flyControlsContainer, "LeftButton", "←", UDim2.new(0, 10, 1, -130), dpadSize) rightButton = createButton(flyControlsContainer, "RightButton", "→", UDim2.new(0, 130, 1, -130), dpadSize) upButton = createButton(flyControlsContainer, "UpButton", "Up", UDim2.new(1, -110, 1, -190), dpadSize) downButton = createButton(flyControlsContainer, "DownButton", "Down", UDim2.new(1, -110, 1, -70), dpadSize) uiToggleButton = createButton(screenGui, "UIToggleButton", "Hide UI", UDim2.new(0, 10, 0, 10), UDim2.new(0, 100, 0, 50)) uiToggleButton.MouseButton1Click:Connect(function() uiVisible = not uiVisible tweenFlyControls(uiVisible) uiToggleButton.Text = uiVisible and "Hide UI" or "Show UI" end) addTouchEvents(forwardButton, "forward") addTouchEvents(backButton, "back") addTouchEvents(leftButton, "left") addTouchEvents(rightButton, "right") addTouchEvents(upButton, "up") addTouchEvents(downButton, "down") player.CharacterAdded:Connect(function(newCharacter) character = newCharacter humanoid = newCharacter:WaitForChild("Humanoid") HRP = newCharacter:WaitForChild("HumanoidRootPart") flying = false end) RunService.RenderStepped:Connect(function(deltaTime) if flying then local moveDirection = Vector3.new(0, 0, 0) local camCF = Camera.CFrame if inputFlags.forward then moveDirection = moveDirection + camCF.LookVector end if inputFlags.back then moveDirection = moveDirection - camCF.LookVector end if inputFlags.left then moveDirection = moveDirection - camCF.RightVector end if inputFlags.right then moveDirection = moveDirection + camCF.RightVector end if inputFlags.up then moveDirection = moveDirection + Vector3.new(0, 1, 0) end if inputFlags.down then moveDirection = moveDirection - Vector3.new(0, 1, 0) end if moveDirection.Magnitude > 0 then moveDirection = moveDirection.Unit end bodyVelocity.Velocity = moveDirection * flySpeed bodyGyro.CFrame = camCF end end) task.delay(2, function() local tweenInfo = TweenInfo.new(0.8, Enum.EasingStyle.Quad, Enum.EasingDirection.Out) local tweenFrame = TweenService:Create(loadingFrame, tweenInfo, { BackgroundTransparency = 1 }) local tweenLabel = TweenService:Create(loadingLabel, tweenInfo, { TextTransparency = 1 }) tweenFrame:Play() tweenLabel:Play() tweenFrame.Completed:Connect(function() loadingFrame:Destroy() end) end)