--[[ WARNING: Heads up! This script has not been verified by ScriptBlox. Use at your own risk! ]] -- Developed for my sempai:33333333333 -- Interface: WindUI | Nome: BotPlay | Créditos: Kasana local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local Players = game:GetService("Players") local LocalPlayer = Players.LocalPlayer local PlayerScripts = LocalPlayer:WaitForChild("PlayerScripts") local Client = PlayerScripts:WaitForChild("Client") local Gameplay = Client:WaitForChild("Gameplay") local UI = Client:WaitForChild("UI") local Note = require(Gameplay:WaitForChild("Note")) local Input = require(Gameplay:WaitForChild("Input")) local Hud = require(Gameplay:WaitForChild("Hud")) local State = require(Client:WaitForChild("Core"):WaitForChild("State")) local Results = require(UI:WaitForChild("Screens"):WaitForChild("Results")) local Round = require(Gameplay:WaitForChild("Round")) if _G.FunkyDuelsCleanup then pcall(_G.FunkyDuelsCleanup) end local Config = { Autoplay = true, HitMode = "Perfect", LegitJitter = 12, AutoHold = true, ServerReplication = true, PreventMisses = true, } local activeHolds = {} local handledNotes = setmetatable({}, { __mode = "k" }) local connections = {} local originalMethods = {} -- ============================================================ -- CACHE DE UPVALUES -- ============================================================ local cache = { noteCtx = nil, noteCtxRound = nil, inputHp = nil, inputHr = nil, inputRound = nil, } local rawTryHitNote = Note.TryHitNote local rawGetResults = Note.GetResults local rawApplyGhostMiss = Note.ApplyGhostMiss local rawSetNoteResolvedCallback = Note.SetNoteResolvedCallback local function sanitizeInt(val, defaultVal, maxVal) local n = tonumber(val) or (defaultVal or 0) if n ~= n or n == math.huge or n == -math.huge then n = defaultVal or 0 end return math.clamp(math.floor(n), 0, maxVal or 999999999) end local function refreshNoteContext() local ok, upvals = pcall(debug.getupvalues, rawTryHitNote) if not ok or not upvals then return nil end local ctx = { conductor = upvals[1], timingOffset = upvals[2] or 0, noteList = upvals[3], roundContext = upvals[4], match = upvals[5], hitNote = upvals[7] } cache.noteCtx = ctx cache.noteCtxRound = ctx.roundContext return ctx end local function getNoteContext() local ctx = cache.noteCtx if not ctx or ctx.roundContext ~= cache.noteCtxRound or not ctx.noteList or not ctx.conductor or not ctx.roundContext then return refreshNoteContext() end return ctx end local function refreshInputHandlers(roundCtx) local ok, upvals = pcall(debug.getupvalues, Input.Init) if not ok or not upvals then return end local bindKb = upvals[8] if not bindKb then return end local ok2, inner = pcall(debug.getupvalues, bindKb) if not ok2 or not inner then return end cache.inputHp = inner[5] cache.inputHr = inner[6] cache.inputRound = roundCtx end local function getInputHandlers(roundCtx) if cache.inputRound ~= roundCtx or not cache.inputHp then refreshInputHandlers(roundCtx) end return cache.inputHp, cache.inputHr end local function isLocalNote(note, context) if not context or not context.SessionLocalSide then return note.IsPlayer == true end return (note.IsPlayer == false) == (context.SessionLocalSide == "Left") end -- ============================================================ -- SAFE SET COUNT -- ============================================================ local showStats = debug.getupvalues(Results.Show)[1] local origSetCount = debug.getupvalues(showStats)[2] local u63 = debug.getupvalues(origSetCount)[1] local function safeSetCount(frame, count) if not frame or not frame:FindFirstChild("Index") then return end local Index = frame.Index for _, c in ipairs(frame:GetChildren()) do if c ~= Index and not c:IsA("UIListLayout") then c:Destroy() end end Index.Visible = false local num = sanitizeInt(count, 0, 999999999) local str = string.format("%d", num) for i = 1, #str do local digit = tonumber(str:sub(i, i)) if digit and u63[digit + 1] and u63[digit + 1][1] then local clone = Index:Clone() clone.LayoutOrder = i clone.Visible = true clone.Image = u63[digit + 1][1].assetId clone.Parent = frame end end end debug.setupvalue(showStats, 2, safeSetCount) debug.setupvalue(Results.Show, 3, safeSetCount) -- ============================================================ -- HOOKS -- ============================================================ originalMethods.SetNoteResolvedCallback = rawSetNoteResolvedCallback Note.SetNoteResolvedCallback = function(callback) local wrappedCallback = function(target, count, isHit, dir, noteData) if target == "player" and Config.ServerReplication then if noteData then noteData.ResolvedSongTimeMs = noteData.TimeMs end if Config.PreventMisses then isHit = true end end return callback(target, count, isHit, dir, noteData) end return rawSetNoteResolvedCallback(wrappedCallback) end originalMethods.ApplyGhostMiss = rawApplyGhostMiss Note.ApplyGhostMiss = function(dir) if Config.PreventMisses then return false end return rawApplyGhostMiss(dir) end originalMethods.Show = Results.Show Results.Show = function(pStats, songName, diff, oppStats, isSolo) local success = pcall(function() originalMethods.Show(pStats, songName, diff, oppStats, isSolo) end) if not success then pcall(function() local up = debug.getupvalues(originalMethods.Show) if up[13] then up[13].Visible = true end end) end end -- ============================================================ -- WATCHDOG (throttled ~10Hz) -- ============================================================ local onSongEnded = debug.getupvalues(Round.StartRound)[35] local songEndWatchdogTriggered = false local lastActiveNoteTime = 0 local watchdogTick = 0 local function checkSongEndWatchdog(liveSongTime, noteList, roundContext) if songEndWatchdogTriggered then return end if Results.IsVisible() then return end if not roundContext or roundContext.RoundOver then return end local hasUnresolvedNotes = false local maxTime = 0 local n = #noteList for i = 1, n do local note = noteList[i] if not note.Hit and not note.Missed then hasUnresolvedNotes = true end local t = note.TimeMs if t and t > maxTime then maxTime = t end end if maxTime > 0 then lastActiveNoteTime = maxTime end if not hasUnresolvedNotes and lastActiveNoteTime > 0 and liveSongTime >= lastActiveNoteTime + 2500 then songEndWatchdogTriggered = true task.defer(function() if onSongEnded and not Results.IsVisible() and not roundContext.RoundOver then pcall(onSongEnded) end end) end end -- ============================================================ -- HEARTBEAT -- ============================================================ local function onHeartbeat() if State.GetState() ~= "InGame" then table.clear(activeHolds) table.clear(handledNotes) songEndWatchdogTriggered = false lastActiveNoteTime = 0 watchdogTick = 0 cache.noteCtx = nil cache.noteCtxRound = nil cache.inputHp = nil cache.inputHr = nil cache.inputRound = nil return end local ctx = getNoteContext() if not ctx or not ctx.conductor or type(ctx.conductor.GetLiveSongTimeMs) ~= "function" or not ctx.noteList or not ctx.roundContext then return end if ctx.roundContext.RoundOver or Note.IsPaused() then return end local liveSongTime = ctx.conductor.GetLiveSongTimeMs() + ctx.timingOffset watchdogTick = watchdogTick + 1 if watchdogTick >= 6 then watchdogTick = 0 checkSongEndWatchdog(liveSongTime, ctx.noteList, ctx.roundContext) end if not Config.Autoplay then return end local hp, hr = getInputHandlers(ctx.roundContext) if Config.AutoHold then for dir, hold in pairs(activeHolds) do if liveSongTime >= hold.endTime - 8 then if hr then hr(dir) end activeHolds[dir] = nil end end end local noteList = ctx.noteList local count = #noteList local hitMode = Config.HitMode local legitJitter = Config.LegitJitter local serverRepl = Config.ServerReplication for i = 1, count do local note = noteList[i] if not note.Hit and not note.Missed and not handledNotes[note] then if isLocalNote(note, ctx.roundContext) then local jitter = 0 if hitMode == "Legit" then if not note._jitter then note._jitter = math.random(-legitJitter, legitJitter) end jitter = note._jitter end local targetHitTime = note.TimeMs + jitter if liveSongTime >= targetHitTime then handledNotes[note] = true if serverRepl then note.ResolvedSongTimeMs = note.TimeMs end if hp then hp(note.Dir) end if not note.Hit then rawTryHitNote(note.Dir) end if note.HoldMs and note.HoldMs > 0 then activeHolds[note.Dir] = { dir = note.Dir, endTime = note.TimeMs + note.HoldMs } else task.delay(0.045 + math.random() * 0.015, function() if hr and not activeHolds[note.Dir] then hr(note.Dir) end end) end end end end end if count == 0 and next(handledNotes) ~= nil then table.clear(handledNotes) end end table.insert(connections, RunService.Heartbeat:Connect(onHeartbeat)) -- ============================================================ -- INTERFACE (WindUI) - BotPlay -- ============================================================ local WindUI = loadstring(game:HttpGet("https://github.com/Footagesus/WindUI/releases/latest/download/main.lua"))() WindUI:AddTheme({ Name = "BotPlayTheme", Accent = Color3.fromHex("#9141EB"), Background = Color3.fromHex("#0E0C14"), Outline = Color3.fromHex("#2D2637"), Text = Color3.fromHex("#D2DCEB"), Placeholder = Color3.fromHex("#7A7A7A"), Button = Color3.fromHex("#18141F"), Icon = Color3.fromHex("#A182C3"), WindowBackground = Color3.fromHex("#0E0C14"), WindowShadow = Color3.fromHex("#000000"), WindowTopbarTitle = Color3.fromHex("#C382FF"), WindowTopbarAuthor = Color3.fromHex("#A182C3"), ElementBackground = Color3.fromHex("#18141F"), ElementTitle = Color3.fromHex("#D2DCEB"), ElementIcon = Color3.fromHex("#A182C3"), Toggle = Color3.fromHex("#9141EB"), ToggleBar = Color3.fromHex("#FFFFFF"), }) local Window = WindUI:CreateWindow({ Title = "BotPlay", Author = "Créditos: Kasana (Criador Original)", Icon = "music", Theme = "BotPlayTheme", ToggleKey = Enum.KeyCode.RightShift, Size = UDim2.fromOffset(480, 360), Resizable = true, }) local MainTab = Window:Tab({ Title = "Autoplay", Icon = "play" }) MainTab:Section({ Title = "Network Replication" }) MainTab:Toggle({ Title = "Server Replicate SICKs (0ms)", Value = Config.ServerReplication, Callback = function(state) Config.ServerReplication = state end, }) MainTab:Toggle({ Title = "Network Suppress Misses", Value = Config.PreventMisses, Callback = function(state) Config.PreventMisses = state end, }) MainTab:Section({ Title = "Autoplay Controls" }) MainTab:Toggle({ Title = "Autoplay Active", Value = Config.Autoplay, Callback = function(state) Config.Autoplay = state end, }) MainTab:Toggle({ Title = "Hit Mode: Perfect (OFF = Legit)", Value = (Config.HitMode == "Perfect"), Callback = function(state) Config.HitMode = state and "Perfect" or "Legit" end, }) MainTab:Toggle({ Title = "Auto Release Holds", Value = Config.AutoHold, Callback = function(state) Config.AutoHold = state end, }) -- ============================================================ -- CLEANUP -- ============================================================ _G.FunkyDuelsCleanup = function() for _, conn in ipairs(connections) do pcall(function() conn:Disconnect() end) end table.clear(connections) Note.TryHitNote = rawTryHitNote Note.GetResults = rawGetResults Note.ApplyGhostMiss = rawApplyGhostMiss Note.SetNoteResolvedCallback = rawSetNoteResolvedCallback if originalMethods.Show then Results.Show = originalMethods.Show end pcall(function() debug.setupvalue(showStats, 2, origSetCount) debug.setupvalue(Results.Show, 3, origSetCount) end) table.clear(activeHolds) table.clear(handledNotes) cache.noteCtx = nil cache.noteCtxRound = nil cache.inputHp = nil cache.inputHr = nil cache.inputRound = nil -- WindUI gerencia a própria janela; não há "gui" local pra destruir. pcall(function() if WindUI and WindUI.Unload then WindUI:Unload() end end) _G.FunkyDuelsCleanup = nil print("[BotPlay] Unloaded cleanly.") end print("BotPlay carregado | Créditos: Kasana")