local Players = game:GetService("Players") local UIS = game:GetService("UserInputService") local RunService = game:GetService("RunService") local player = Players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") local MIN_SPEED, MAX_SPEED = 1, 500 local speed = 50 local flying = false local minimized = false local vertical = 0 local flyConnection local velocity, gyro local root, humanoid local currentCharacter local currentRig = "UNKNOWN" local holdToken = 0 local selectedAnimation = nil local idleTrack, runTrack local animationConnection local savedAnimateEnabled local TEST_IDLE_ID = "rbxassetid://111" local TEST_RUN_ID = "rbxassetid://111" local oldGui = playerGui:FindFirstChild("UniversalFlyGui") if oldGui then oldGui:Destroy() end local function make(className, properties, parent) local obj = Instance.new(className) for key, value in pairs(properties) do obj[key] = value end obj.Parent = parent return obj end local function createButton(text, position, size, color, parent, textSize) local button = make("TextButton", { Position = position, Size = size, BackgroundColor3 = color, Text = text, TextColor3 = Color3.fromRGB(245, 248, 255), Font = Enum.Font.GothamBold, TextSize = textSize or 14, BorderSizePixel = 0, AutoButtonColor = true, Active = true }, parent) make("UICorner", { CornerRadius = UDim.new(0, 9) }, button) return button end local gui = make("ScreenGui", { Name = "UniversalFlyGui", ResetOnSpawn = false, IgnoreGuiInset = true, DisplayOrder = 20 }, playerGui) local main = make("Frame", { Name = "Main", Size = UDim2.fromOffset(310, 385), Position = UDim2.new(0.5, -155, 0.5, -192), BackgroundColor3 = Color3.fromRGB(19, 24, 38), BorderSizePixel = 0 }, gui) make("UICorner", { CornerRadius = UDim.new(0, 16) }, main) make("UIStroke", { Color = Color3.fromRGB(75, 130, 230), Thickness = 1.4 }, main) local header = make("Frame", { Name = "Header", Size = UDim2.new(1, 0, 0, 49), BackgroundColor3 = Color3.fromRGB(34, 48, 75), BorderSizePixel = 0 }, main) make("UICorner", { CornerRadius = UDim.new(0, 16) }, header) make("Frame", { Position = UDim2.new(0, 0, 1, -12), Size = UDim2.new(1, 0, 0, 12), BackgroundColor3 = header.BackgroundColor3, BorderSizePixel = 0 }, header) make("TextLabel", { Position = UDim2.fromOffset(12, 0), Size = UDim2.new(1, -105, 1, 0), BackgroundTransparency = 1, Text = "Universal Fly v1", TextColor3 = Color3.fromRGB(225, 237, 255), Font = Enum.Font.GothamBold, TextSize = 14, TextXAlignment = Enum.TextXAlignment.Left }, header) local minimize = createButton( "-", UDim2.new(1, -69, 0, 9), UDim2.fromOffset(26, 29), Color3.fromRGB(62, 76, 101), header, 21 ) local close = createButton( "X", UDim2.new(1, -37, 0, 9), UDim2.fromOffset(27, 29), Color3.fromRGB(184, 58, 72), header, 17 ) local content = make("Frame", { Name = "Content", Position = UDim2.fromOffset(12, 55), Size = UDim2.new(1, -24, 1, -91), BackgroundTransparency = 1 }, main) local rigLabel = make("TextLabel", { Name = "RigTypeLabel", Position = UDim2.fromOffset(0, -2), Size = UDim2.new(1, 0, 0, 18), BackgroundTransparency = 1, Text = "RIG: DETECTING...", TextColor3 = Color3.fromRGB(111, 190, 255), Font = Enum.Font.GothamBold, TextSize = 11, TextXAlignment = Enum.TextXAlignment.Left }, content) local flyButton = createButton( "FLY : OFF", UDim2.fromOffset(0, 39), UDim2.new(1, 0, 0, 42), Color3.fromRGB(190, 55, 70), content, 15 ) make("TextLabel", { Position = UDim2.fromOffset(0, 85), Size = UDim2.new(1, 0, 0, 20), BackgroundTransparency = 1, Text = "FLY SPEED", TextColor3 = Color3.fromRGB(151, 174, 210), Font = Enum.Font.GothamBold, TextSize = 11, TextXAlignment = Enum.TextXAlignment.Left }, content) local speedCard = make("Frame", { Position = UDim2.fromOffset(0, 108), Size = UDim2.new(1, 0, 0, 45), BackgroundColor3 = Color3.fromRGB(30, 40, 59), BorderSizePixel = 0 }, content) make("UICorner", { CornerRadius = UDim.new(0, 11) }, speedCard) local minus = createButton( "-", UDim2.fromOffset(6, 5), UDim2.fromOffset(40, 35), Color3.fromRGB(55, 71, 99), speedCard, 19 ) local speedText = make("TextLabel", { Position = UDim2.new(0, 53, 0, 0), Size = UDim2.new(1, -106, 1, 0), BackgroundTransparency = 1, Text = tostring(speed), TextColor3 = Color3.fromRGB(111, 190, 255), Font = Enum.Font.GothamBold, TextSize = 22 }, speedCard) local plus = createButton( "+", UDim2.new(1, -46, 0, 5), UDim2.fromOffset(40, 35), Color3.fromRGB(49, 105, 178), speedCard, 19 ) make("TextLabel", { Position = UDim2.fromOffset(0, 157), Size = UDim2.new(1, 0, 0, 20), BackgroundTransparency = 1, Text = "TEST DOWN UP", TextColor3 = Color3.fromRGB(151, 174, 210), Font = Enum.Font.GothamBold, TextSize = 11, TextXAlignment = Enum.TextXAlignment.Left }, content) local up = createButton( "UP", UDim2.fromOffset(0, 181), UDim2.new(0.485, 0, 0, 36), Color3.fromRGB(38, 126, 100), content, 13 ) local down = createButton( "DOWN", UDim2.new(0.515, 0, 0, 181), UDim2.new(0.485, 0, 0, 36), Color3.fromRGB(112, 73, 150), content, 13 ) local animationButton = createButton( "Fly Animation", UDim2.fromOffset(0, 225), UDim2.new(1, 0, 0, 36), Color3.fromRGB(49, 105, 178), content, 13 ) animationButton.Visible = false local footer = make("TextLabel", { Position = UDim2.new(0, 0, 1, -23), Size = UDim2.new(1, 0, 0, 18), BackgroundTransparency = 1, Text = "SCRIPT CREATED BY SCRIPTBOX", TextColor3 = Color3.fromRGB(105, 121, 147), Font = Enum.Font.GothamMedium, TextSize = 9 }, main) local animationsGui = make("Frame", { Name = "Animations", Size = UDim2.fromOffset(270, 230), Position = UDim2.new(0.5, -135, 0.5, -115), BackgroundColor3 = Color3.fromRGB(19, 24, 38), BorderSizePixel = 0, Visible = false, Active = true, ZIndex = 30 }, gui) make("UICorner", { CornerRadius = UDim.new(0, 14) }, animationsGui) make("UIStroke", { Color = Color3.fromRGB(75, 130, 230), Thickness = 1.4 }, animationsGui) local animationsHeader = make("Frame", { Name = "Header", Size = UDim2.new(1, 0, 0, 44), BackgroundColor3 = Color3.fromRGB(34, 48, 75), BorderSizePixel = 0, ZIndex = 31 }, animationsGui) make("UICorner", { CornerRadius = UDim.new(0, 14) }, animationsHeader) make("Frame", { Position = UDim2.new(0, 0, 1, -10), Size = UDim2.new(1, 0, 0, 10), BackgroundColor3 = animationsHeader.BackgroundColor3, BorderSizePixel = 0, ZIndex = 31 }, animationsHeader) make("TextLabel", { Position = UDim2.fromOffset(12, 0), Size = UDim2.new(1, -55, 1, 0), BackgroundTransparency = 1, Text = "Animations", TextColor3 = Color3.fromRGB(225, 237, 255), Font = Enum.Font.GothamBold, TextSize = 15, TextXAlignment = Enum.TextXAlignment.Left, ZIndex = 32 }, animationsHeader) local animationsClose = createButton( "X", UDim2.new(1, -38, 0, 8), UDim2.fromOffset(28, 28), Color3.fromRGB(184, 58, 72), animationsHeader, 14 ) animationsClose.ZIndex = 33 local walkAnimButton = createButton( "ROBLOX WALK", UDim2.fromOffset(12, 58), UDim2.new(1, -24, 0, 36), Color3.fromRGB(49, 105, 178), animationsGui, 13 ) walkAnimButton.ZIndex = 32 local testButton = createButton( "TEST", UDim2.fromOffset(12, 104), UDim2.new(1, -24, 0, 36), Color3.fromRGB(112, 73, 150), animationsGui, 13 ) testButton.ZIndex = 32 local resetAnimButton = createButton( "RESET", UDim2.fromOffset(12, 150), UDim2.new(1, -24, 0, 36), Color3.fromRGB(184, 58, 72), animationsGui, 13 ) resetAnimButton.ZIndex = 32 local function makeDraggable(frame, handle) local dragging = false local startPointer, startPos handle.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true startPointer = input.Position startPos = frame.Position end end) UIS.InputChanged:Connect(function(input) if not dragging then return end if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then local delta = input.Position - startPointer frame.Position = UDim2.new( startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y ) end end) UIS.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = false end end) end makeDraggable(main, header) makeDraggable(animationsGui, animationsHeader) local function stopAnimationTracks() if animationConnection then animationConnection:Disconnect() animationConnection = nil end for _, track in ipairs({idleTrack, runTrack}) do if track then pcall(function() track:Stop(0.15) track:Destroy() end) end end idleTrack, runTrack = nil, nil end local function restoreDefaultAnimate() stopAnimationTracks() local animateScript = currentCharacter and currentCharacter:FindFirstChild("Animate") if animateScript and savedAnimateEnabled ~= nil then animateScript.Disabled = savedAnimateEnabled end savedAnimateEnabled = nil end local function disableDefaultAnimate() local animateScript = currentCharacter and currentCharacter:FindFirstChild("Animate") if animateScript then if savedAnimateEnabled == nil then savedAnimateEnabled = animateScript.Disabled end animateScript.Disabled = true end end local function getAnimator() if not humanoid or not humanoid.Parent then return nil end local animator = humanoid:FindFirstChildOfClass("Animator") if not animator then animator = Instance.new("Animator") animator.Parent = humanoid end return animator end local function loadTrack(animationId) local animator = getAnimator() if not animator then return nil end local animation = Instance.new("Animation") animation.AnimationId = animationId local ok, track = pcall(function() return animator:LoadAnimation(animation) end) animation:Destroy() return track end local function playRobloxWalk() stopAnimationTracks() if not humanoid or not humanoid.Parent then return end disableDefaultAnimate() local isR6 = humanoid.RigType == Enum.HumanoidRigType.R6 local idleId = isR6 and "rbxassetid://180435571" or "rbxassetid://507766666" local runId = isR6 and "rbxassetid://180426354" or "rbxassetid://507767714" idleTrack = loadTrack(idleId) runTrack = loadTrack(runId) if not idleTrack or not runTrack then restoreDefaultAnimate() return end idleTrack.Looped = true runTrack.Looped = true idleTrack.Priority = Enum.AnimationPriority.Movement runTrack.Priority = Enum.AnimationPriority.Movement idleTrack:Play(0.15) animationConnection = RunService.Heartbeat:Connect(function() if not flying or selectedAnimation ~= "WALK" or not humanoid or not humanoid.Parent then return end local moving = humanoid.MoveDirection.Magnitude > 0.05 if moving then if idleTrack and idleTrack.IsPlaying then idleTrack:Stop(0.15) end if runTrack and not runTrack.IsPlaying then runTrack:Play(0.15) end else if runTrack and runTrack.IsPlaying then runTrack:Stop(0.15) end if idleTrack and not idleTrack.IsPlaying then idleTrack:Play(0.15) end end end) end local function playTestAnimation() stopAnimationTracks() if not humanoid or not humanoid.Parent then return end disableDefaultAnimate() idleTrack = loadTrack(TEST_IDLE_ID) runTrack = loadTrack(TEST_RUN_ID) if not idleTrack or not runTrack then restoreDefaultAnimate() return end idleTrack.Looped = true runTrack.Looped = true idleTrack.Priority = Enum.AnimationPriority.Movement runTrack.Priority = Enum.AnimationPriority.Movement idleTrack:Play(0.15) animationConnection = RunService.Heartbeat:Connect(function() if not flying or selectedAnimation ~= "TEST" or not humanoid or not humanoid.Parent then return end local moving = humanoid.MoveDirection.Magnitude > 0.05 if moving then if idleTrack and idleTrack.IsPlaying then idleTrack:Stop(0.15) end if runTrack and not runTrack.IsPlaying then runTrack:Play(0.15) end else if runTrack and runTrack.IsPlaying then runTrack:Stop(0.15) end if idleTrack and not idleTrack.IsPlaying then idleTrack:Play(0.15) end end end) end local function playSelectedAnimation() if not flying or not selectedAnimation then return end if selectedAnimation == "WALK" then playRobloxWalk() elseif selectedAnimation == "TEST" then playTestAnimation() end end local function resetFlyAnimation() selectedAnimation = nil restoreDefaultAnimate() end local function detectRig(character) currentCharacter = character currentRig = "UNKNOWN" rigLabel.Text = "RIG: DETECTING..." animationButton.Visible = false local foundHumanoid = character:WaitForChild("Humanoid", 10) if not foundHumanoid or player.Character ~= character then return end humanoid = foundHumanoid root = character:FindFirstChild("HumanoidRootPart") if humanoid.RigType == Enum.HumanoidRigType.R6 then currentRig = "R6" rigLabel.Text = "RIG: R6" rigLabel.TextColor3 = Color3.fromRGB(255, 190, 100) else currentRig = "R15" rigLabel.Text = "RIG: R15" rigLabel.TextColor3 = Color3.fromRGB(100, 220, 160) animationButton.Visible = true end end local function updateSpeed(amount) speed = math.clamp(speed + amount, MIN_SPEED, MAX_SPEED) speedText.Text = tostring(speed) end local function stopSpeedHold() holdToken += 1 end local function startSpeedHold(direction) holdToken += 1 local token = holdToken updateSpeed(direction) task.spawn(function() task.wait(0.4) while holdToken == token and gui.Parent do updateSpeed(direction) task.wait(0.15) end end) end local function bindSpeedButton(button, direction) button.Activated:Connect(function() updateSpeed(direction) end) button.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then startSpeedHold(direction) end end) end bindSpeedButton(plus, 1) bindSpeedButton(minus, -1) UIS.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then stopSpeedHold() end end) local function stopFly() flying = false vertical = 0 if flyConnection then flyConnection:Disconnect() flyConnection = nil end if velocity then velocity:Destroy() velocity = nil end if gyro then gyro:Destroy() gyro = nil end if humanoid and humanoid.Parent then humanoid.PlatformStand = false humanoid:ChangeState(Enum.HumanoidStateType.GettingUp) end restoreDefaultAnimate() flyButton.Text = "FLY : OFF" flyButton.BackgroundColor3 = Color3.fromRGB(190, 55, 70) end local function startFly() local character = player.Character if not character then return end local newRoot = character:FindFirstChild("HumanoidRootPart") local newHumanoid = character:FindFirstChildOfClass("Humanoid") if not newRoot or not newHumanoid then return end root = newRoot humanoid = newHumanoid currentCharacter = character flying = true humanoid.PlatformStand = true velocity = Instance.new("BodyVelocity") velocity.MaxForce = Vector3.new(1e6, 1e6, 1e6) velocity.Velocity = Vector3.zero velocity.Parent = root gyro = Instance.new("BodyGyro") gyro.MaxTorque = Vector3.new(1e6, 1e6, 1e6) gyro.P = 9000 gyro.Parent = root flyButton.Text = "FLY : ON" flyButton.BackgroundColor3 = Color3.fromRGB(35, 166, 103) playSelectedAnimation() flyConnection = RunService.RenderStepped:Connect(function() if not flying or not root or not root.Parent or not humanoid or not humanoid.Parent or character ~= player.Character then stopFly() return end local camera = workspace.CurrentCamera if not camera then return end local direction = Vector3.zero if UIS:IsKeyDown(Enum.KeyCode.W) then direction += camera.CFrame.LookVector end if UIS:IsKeyDown(Enum.KeyCode.S) then direction -= camera.CFrame.LookVector end if UIS:IsKeyDown(Enum.KeyCode.A) then direction -= camera.CFrame.RightVector end if UIS:IsKeyDown(Enum.KeyCode.D) then direction += camera.CFrame.RightVector end direction += Vector3.new(0, vertical, 0) velocity.Velocity = direction.Magnitude > 0 and direction.Unit * speed or Vector3.zero gyro.CFrame = camera.CFrame end) end flyButton.Activated:Connect(function() if flying then stopFly() else startFly() end end) local function bindVerticalButton(button, value) button.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1 then vertical = value end end) button.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1 then if vertical == value then vertical = 0 end end end) end bindVerticalButton(up, 1) bindVerticalButton(down, -1) animationButton.Activated:Connect(function() if currentRig == "R15" then animationsGui.Visible = true end end) animationsClose.Activated:Connect(function() animationsGui.Visible = false end) walkAnimButton.Activated:Connect(function() selectedAnimation = "WALK" if flying then playRobloxWalk() end end) testButton.Activated:Connect(function() if currentRig ~= "R15" then return end selectedAnimation = "TEST" if flying then playTestAnimation() end end) resetAnimButton.Activated:Connect(function() resetFlyAnimation() end) minimize.Activated:Connect(function() minimized = not minimized content.Visible = not minimized footer.Visible = not minimized if minimized then main.Size = UDim2.fromOffset(245, 49) minimize.Text = "+" else main.Size = UDim2.fromOffset(310, 385) minimize.Text = "-" end end) close.Activated:Connect(function() stopFly() stopSpeedHold() gui:Destroy() end) player.CharacterAdded:Connect(function(character) stopFly() resetFlyAnimation() animationsGui.Visible = false task.spawn(detectRig, character) end) player.CharacterRemoving:Connect(function(character) if character == currentCharacter then stopFly() currentRig = "UNKNOWN" animationButton.Visible = false animationsGui.Visible = false end end) if player.Character then task.spawn(detectRig, player.Character) end