--// MODERN FLY UI v5.1 – WORKING local Players = game:GetService("Players") local RunService = game:GetService("RunService") local TweenService = game:GetService("TweenService") local ContextActionService = game:GetService("ContextActionService") local Lighting = game:GetService("Lighting") local player = Players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") local camera = workspace.CurrentCamera --// STATE local flying = false local flySpeed = 80 local verticalSpeed = 60 local bodyGyro, bodyVelocity --// INPUT local joyInput = Vector2.new() local joySmooth = Vector2.new() local upPressed = false local downPressed = false --// CONSTANTS local JOY_RADIUS = 70 local JOY_SPRING_K = 200 local JOY_DAMPING = 20 -------------------------------------------------------------------- --// 1. CREATE BLUR EFFECTS IN LIGHTING -------------------------------------------------------------------- local blur = Instance.new("BlurEffect") blur.Size = 0 blur.Parent = Lighting local function setBlur(size) blur.Size = size end -------------------------------------------------------------------- --// 2. FLY BUTTON (GLASS + NEON GLOW) -------------------------------------------------------------------- local flyGui = Instance.new("ScreenGui") flyGui.Name = "ModernFlyUI" flyGui.ResetOnSpawn = false flyGui.Parent = playerGui local flyFrame = Instance.new("Frame") flyFrame.Size = UDim2.new(0, 110, 0, 110) flyFrame.Position = UDim2.new(0.05, 0, 0.75, 0) flyFrame.BackgroundTransparency = 0.75 flyFrame.BackgroundColor3 = Color3.fromRGB(20, 20, 30) flyFrame.Active = true flyFrame.ClipsDescendants = true flyFrame.Parent = flyGui local flyCorner = Instance.new("UICorner") flyCorner.CornerRadius = UDim.new(1, 0) flyCorner.Parent = flyFrame local flyStroke = Instance.new("UIStroke") flyStroke.Thickness = 2 flyStroke.Color = Color3.fromRGB(0, 200, 255) flyStroke.Transparency = 0.5 flyStroke.Parent = flyFrame local flyButton = Instance.new("TextButton") flyButton.Size = UDim2.new(0, 70, 0, 70) flyButton.Position = UDim2.new(0.5, -35, 0.5, -35) flyButton.BackgroundTransparency = 1 flyButton.Text = "FLY" flyButton.TextColor3 = Color3.fromRGB(0, 200, 255) flyButton.FontFace = Font.fromEnum(Enum.Font.GothamBold) flyButton.TextSize = 24 flyButton.Parent = flyFrame -- Neon Pulse local function pulseGlow() TweenService:Create(flyStroke, TweenInfo.new(1.2, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, -1, true), { Transparency = 0.3 }):Play() end pulseGlow() -- Drag local dragTarget = flyFrame.Position local dragPos = flyFrame.Position local dragVel = Vector2.new() local function updateDrag() local delta = Vector2.new(dragTarget.X.Offset - dragPos.X.Offset, dragTarget.Y.Offset - dragPos.Y.Offset) dragVel = dragVel + delta * 30 dragVel = dragVel * 0.9 dragPos = UDim2.new(0, dragPos.X.Offset + dragVel.X, 0, dragPos.Y.Offset + dragVel.Y) flyFrame.Position = dragPos end local dragging = false flyFrame.InputBegan:Connect(function(input) if input.UserInputType ~= Enum.UserInputType.MouseButton1 and input.UserInputType ~= Enum.UserInputType.Touch then return end dragging = true dragTarget = flyFrame.Position dragVel = Vector2.new() TweenService:Create(flyFrame, TweenInfo.new(0.15), {Size = UDim2.new(0, 120, 0, 120)}):Play() end) flyFrame.InputChanged:Connect(function(input) if not dragging then return end local delta = input.Position - Vector2.new( input.Position.X - (dragTarget.X.Offset - (flyFrame.Position.X.Offset - dragPos.X.Offset)), input.Position.Y - (dragTarget.Y.Offset - (flyFrame.Position.Y.Offset - dragPos.Y.Offset)) ) dragTarget = UDim2.new(0, dragTarget.X.Offset + delta.X, 0, dragTarget.Y.Offset + delta.Y) end) flyFrame.InputEnded:Connect(function() if not dragging then return end dragging = false TweenService:Create(flyFrame, TweenInfo.new(0.3, Enum.EasingStyle.Back), {Size = UDim2.new(0, 110, 0, 110)}):Play() end) RunService.Heartbeat:Connect(updateDrag) -------------------------------------------------------------------- --// 3. JOYSTICK (GLASS + GLOW) -------------------------------------------------------------------- local joyGui = Instance.new("ScreenGui") joyGui.ResetOnSpawn = false joyGui.Parent = playerGui local joyBase = Instance.new("Frame") joyBase.Size = UDim2.new(0, 140, 0, 140) joyBase.Position = UDim2.new(0, 30, 1, -170) joyBase.BackgroundTransparency = 0.8 joyBase.BackgroundColor3 = Color3.fromRGB(15, 15, 25) joyBase.Parent = joyGui local baseCorner = Instance.new("UICorner") baseCorner.CornerRadius = UDim.new(1, 0) baseCorner.Parent = joyBase local baseStroke = Instance.new("UIStroke") baseStroke.Thickness = 1.5 baseStroke.Color = Color3.fromRGB(0, 180, 255) baseStroke.Transparency = 0.7 baseStroke.Parent = joyBase local joyKnob = Instance.new("Frame") joyKnob.Size = UDim2.new(0, 60, 0, 60) joyKnob.Position = UDim2.new(0.5, -30, 0.5, -30) joyKnob.BackgroundColor3 = Color3.fromRGB(0, 200, 255) joyKnob.Parent = joyBase local knobCorner = Instance.new("UICorner") knobCorner.CornerRadius = UDim.new(1, 0) knobCorner.Parent = joyKnob local knobStroke = Instance.new("UIStroke") knobStroke.Thickness = 3 knobStroke.Color = Color3.fromRGB(0, 255, 255) knobStroke.Transparency = 0.4 knobStroke.Parent = joyKnob -- Knob Pulse spawn(function() while wait(1) do TweenService:Create(knobStroke, TweenInfo.new(0.8, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, -1, true), { Transparency = 0.2 }):Play() end end) local function updateKnob(dir, dist) local target = UDim2.new(0.5, dir.X * dist - 30, 0.5, dir.Y * dist - 30) joyKnob:TweenPosition(target, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0.1, true) end -- Joystick Input local JOY_ACTION = "ModernFlyJoy" ContextActionService:BindAction(JOY_ACTION, function(_, state, input) if state == Enum.UserInputState.Begin then elseif state == Enum.UserInputState.Change then local center = joyBase.AbsolutePosition + joyBase.AbsoluteSize * 0.5 local delta = Vector2.new(input.Position.X, input.Position.Y) - center local mag = math.min(delta.Magnitude, JOY_RADIUS) local dir = if mag > 0 then delta.Unit else Vector2.new() joyInput = dir * (mag / JOY_RADIUS) updateKnob(dir, mag) elseif state == Enum.UserInputState.End or state == Enum.UserInputState.Cancel then joyInput = Vector2.new() updateKnob(Vector2.new(), 0) end return Enum.ContextActionResult.Sink end, false, Enum.UserInputType.Touch) local function updateHitbox() local center = joyBase.AbsolutePosition + joyBase.AbsoluteSize * 0.5 ContextActionService:SetPosition(JOY_ACTION, UDim2.fromOffset(center.X, center.Y)) ContextActionService:SetRadius(JOY_ACTION, JOY_RADIUS) end joyBase:GetPropertyChangedSignal("AbsoluteSize"):Connect(updateHitbox) joyBase:GetPropertyChangedSignal("AbsolutePosition"):Connect(updateHitbox) task.spawn(updateHitbox) -- Spring RunService.Heartbeat:Connect(function(dt) if joyInput.Magnitude > 0 then local f = (joyInput - joySmooth) * JOY_SPRING_K local d = -joySmooth * JOY_DAMPING joySmooth = joySmooth + (f + d) * dt else joySmooth = joySmooth:Lerp(Vector2.new(), math.min(1, 15 * dt)) end end) -------------------------------------------------------------------- --// 4. UP/DOWN BUTTONS -------------------------------------------------------------------- local udGui = Instance.new("ScreenGui") udGui.ResetOnSpawn = false udGui.Parent = playerGui local function makeBtn(pos, icon, color) local btn = Instance.new("TextButton") btn.Size = UDim2.new(0, 55, 0, 55) btn.Position = pos btn.BackgroundTransparency = 0.75 btn.BackgroundColor3 = Color3.fromRGB(20, 20, 30) btn.Text = icon btn.TextColor3 = color btn.FontFace = Font.fromEnum(Enum.Font.GothamBold) btn.TextSize = 28 btn.Parent = udGui local corner = Instance.new("UICorner") corner.CornerRadius = UDim.new(1, 0) corner.Parent = btn local stroke = Instance.new("UIStroke") stroke.Thickness = 1.5 stroke.Color = color stroke.Transparency = 0.6 stroke.Parent = btn return btn end local upBtn = makeBtn(UDim2.new(1, -75, 1, -165), "UP", Color3.fromRGB(0, 220, 120)) local downBtn = makeBtn(UDim2.new(1, -75, 1, -100), "DOWN", Color3.fromRGB(255, 100, 120)) local function press(btn, down) TweenService:Create(btn, TweenInfo.new(0.12), { Size = down and UDim2.new(0, 50, 0, 50) or UDim2.new(0, 55, 0, 55), BackgroundTransparency = down and 0.6 or 0.75 }):Play() end upBtn.MouseButton1Down:Connect(function() upPressed = true; press(upBtn, true) end) upBtn.MouseButton1Up:Connect(function() upPressed = false; press(upBtn, false) end) downBtn.MouseButton1Down:Connect(function() downPressed = true; press(downBtn, true) end) downBtn.MouseButton1Up:Connect(function() downPressed = false; press(downBtn, false) end) -------------------------------------------------------------------- --// 5. FLY SYSTEM -------------------------------------------------------------------- local function startFlying() if flying then return end flying = true TweenService:Create(flyButton, TweenInfo.new(0.2), {TextColor3 = Color3.fromRGB(0, 255, 100)}):Play() TweenService:Create(flyStroke, TweenInfo.new(0.2), {Color = Color3.fromRGB(0, 255, 100)}):Play() setBlur(8) 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 = 20000 bodyGyro.MaxTorque = Vector3.new(1e5, 1e5, 1e5) bodyGyro.CFrame = root.CFrame bodyGyro.Parent = root bodyVelocity = Instance.new("BodyVelocity") bodyVelocity.MaxForce = Vector3.new(1e5, 1e5, 1e5) bodyVelocity.Velocity = Vector3.zero bodyVelocity.Parent = root end local function stopFlying() if not flying then return end flying = false TweenService:Create(flyButton, TweenInfo.new(0.2), {TextColor3 = Color3.fromRGB(0, 200, 255)}):Play() TweenService:Create(flyStroke, TweenInfo.new(0.2), {Color = Color3.fromRGB(0, 200, 255)}):Play() setBlur(0) if bodyGyro then bodyGyro:Destroy() end if bodyVelocity then bodyVelocity:Destroy() end bodyGyro, bodyVelocity = nil, nil 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) -------------------------------------------------------------------- --// 6. MOVEMENT -------------------------------------------------------------------- RunService.Heartbeat:Connect(function() if not flying or not player.Character then return end local root = player.Character:FindFirstChild("HumanoidRootPart") if not root or not bodyVelocity then return end local move = Vector3.new(joySmooth.X, 0, -joySmooth.Y) if move.Magnitude > 0.05 then local look = camera.CFrame.LookVector local right = camera.CFrame.RightVector local world = (look * move.Z + right * move.X) * flySpeed bodyVelocity.Velocity = Vector3.new(world.X, bodyVelocity.Velocity.Y, world.Z) else bodyVelocity.Velocity = Vector3.new(0, bodyVelocity.Velocity.Y, 0) end local vert = 0 if upPressed then vert += verticalSpeed end if downPressed then vert -= verticalSpeed end if vert == 0 and math.abs(bodyVelocity.Velocity.Y) < 2 then bodyVelocity.Velocity = Vector3.new(bodyVelocity.Velocity.X, 0.4, bodyVelocity.Velocity.Z) else bodyVelocity.Velocity = Vector3.new(bodyVelocity.Velocity.X, vert, bodyVelocity.Velocity.Z) end bodyGyro.CFrame = camera.CFrame end) -------------------------------------------------------------------- --// 7. CLEANUP -------------------------------------------------------------------- player.CharacterAdded:Connect(function() if flying then task.spawn(stopFlying) end end) -- Optional: Remove blur on leave Players.PlayerRemoving:Connect(function(p) if p == player then blur:Destroy() end end)