-- Minigame Highlighter (Flow solver + 50% overlay). Run client-side before opening a generator. local RS = game:GetService("ReplicatedStorage") local Players = game:GetService("Players") local RunService = game:GetService("RunService") local LP = Players.LocalPlayer local ALPHA = 0.5 -- 50% transparency ------------------------------------------------------------ Flow solver local function readPoint(v) if typeof(v) == "Vector2" then return v.X, v.Y end if type(v) == "table" then local x = v.x or v.X or v.Col or v.col or v[1] local y = v.y or v.Y or v.Row or v.row or v[2] return x, y end end local function normalize(pairsRaw, n) local list, minC, maxC = {}, math.huge, -math.huge for i, p in ipairs(pairsRaw) do local a = p.A or p.a or p.Start or p.From or p[1] local b = p.B or p.b or p.End or p.To or p[2] local ax, ay = readPoint(a) local bx, by = readPoint(b) if ax and ay and bx and by then for _, c in ipairs({ ax, ay, bx, by }) do minC, maxC = math.min(minC, c), math.max(maxC, c) end local col = p.Color or p.color list[#list + 1] = { a = { x = ax, y = ay }, b = { x = bx, y = by }, color = typeof(col) == "Color3" and col or Color3.fromHSV((i - 1) / #pairsRaw, 0.85, 1) } end end local base = (minC >= 1 and maxC == n) and 1 or 0 for _, p in ipairs(list) do p.a.x -= base; p.a.y -= base; p.b.x -= base; p.b.y -= base end return list end local function solve(n, pr, requireFull) local k, owner, paths, heads, done = #pr, {}, {}, {}, {} local filled, nodes = 2 * k, 0 local dirs = { { 1, 0 }, { -1, 0 }, { 0, 1 }, { 0, -1 } } for i, p in ipairs(pr) do owner[p.a.y * n + p.a.x] = i owner[p.b.y * n + p.b.x] = i paths[i] = { { x = p.a.x, y = p.a.y } } heads[i] = { x = p.a.x, y = p.a.y } end local function free(x, y) return x >= 0 and y >= 0 and x < n and y < n and owner[y * n + x] == nil end local function movesOf(i) local h, t, out = heads[i], pr[i].b, {} for _, d in ipairs(dirs) do local x, y = h.x + d[1], h.y + d[2] if x == t.x and y == t.y then out[#out + 1] = { x = x, y = y, fin = true } elseif free(x, y) then out[#out + 1] = { x = x, y = y } end end return out end local function deadCell() for y = 0, n - 1 do for x = 0, n - 1 do if free(x, y) then local open = 0 for _, d in ipairs(dirs) do local nx, ny = x + d[1], y + d[2] if free(nx, ny) then open += 1 else for i = 1, k do if not done[i] and ((heads[i].x == nx and heads[i].y == ny) or (pr[i].b.x == nx and pr[i].b.y == ny)) then open += 1 break end end end end if open < (requireFull and 2 or 0) then return true end end end end return false end local function search() nodes += 1 if nodes > 3e6 then return false end local best, bm for i = 1, k do if not done[i] then local m = movesOf(i) if #m == 0 then return false end if not bm or #m < #bm then best, bm = i, m end end end if not best then return (not requireFull) or filled == n * n end if requireFull and deadCell() then return false end for _, m in ipairs(bm) do if m.fin then done[best] = true paths[best][#paths[best] + 1] = { x = m.x, y = m.y } if search() then return true end table.remove(paths[best]); done[best] = nil else local old = heads[best] owner[m.y * n + m.x] = best; filled += 1 heads[best] = { x = m.x, y = m.y } paths[best][#paths[best] + 1] = heads[best] if search() then return true end table.remove(paths[best]); heads[best] = old owner[m.y * n + m.x] = nil; filled -= 1 end end return false end if search() then return paths end end ------------------------------------------------------------ Overlay local function findBoard(container) local best, area = nil, 0 for _, d in ipairs(container:GetDescendants()) do if d:IsA("GuiObject") then local s = d.AbsoluteSize if s.X > 50 and math.abs(s.X - s.Y) < 6 and s.X * s.Y > area and s.X * s.Y < container.AbsoluteSize.X * container.AbsoluteSize.Y * 1.01 then best, area = d, s.X * s.Y end end end return best end local function drawFlow(gui, n, pr, paths) local board for _ = 1, 40 do board = findBoard(gui.Container) if board then break end task.wait(0.05) end if not board then return end local overlay = Instance.new("Frame") overlay.Name = "SolutionOverlay" overlay.BackgroundTransparency = 1 overlay.ZIndex = 100 overlay.Parent = gui for i, path in ipairs(paths) do for _, c in ipairs(path) do local cell = Instance.new("Frame") cell.BorderSizePixel = 0 cell.BackgroundColor3 = pr[i].color cell.BackgroundTransparency = ALPHA cell.ZIndex = 100 cell.Size = UDim2.fromScale(1 / n, 1 / n) cell.Position = UDim2.fromScale(c.x / n, c.y / n) cell.Parent = overlay end end local conn conn = RunService.RenderStepped:Connect(function() if not gui.Parent then conn:Disconnect() return end local p = board.AbsolutePosition - gui.AbsolutePosition overlay.Position = UDim2.fromOffset(p.X, p.Y) overlay.Size = UDim2.fromOffset(board.AbsoluteSize.X, board.AbsoluteSize.Y) end) end ------------------------------------------------------------ Hook local function activeGui() for _, g in ipairs(LP.PlayerGui:GetChildren()) do if g:FindFirstChild("Container") and not g:FindFirstChild("SolutionOverlay") then return g end end end local function hook(moduleName, onStarted) local ok, mod = pcall(function() return require(RS.Systems.Player.Game.Minigames[moduleName]) end) if not ok then return warn("highlighter: can't require " .. moduleName) end local origSession = mod.Session rawset(mod, "Session", function(self, id, props) local s = origSession(self, id, props) local origStart = s.Start s.Start = function(me, ...) origStart(me, ...) task.spawn(function() local gui for _ = 1, 40 do gui = activeGui() if gui then break end task.wait(0.05) end if gui then onStarted(me, gui) end end) end return s end) end hook("FlowClientMinigame", function(s, gui) local P = s.Network.Properties local n = P:Get("GridSize") local pr, raw = {}, P:Get("Pairs") for i, p in ipairs(raw) do local function xy(idx) return { x = (idx - 1) % n, y = (idx - 1) // n } end pr[i] = { a = xy(p[1]), b = xy(p[2]), color = Color3.fromHSV((i - 1) / #raw, 0.85, 1) } end local paths = solve(n, pr, true) or solve(n, pr, false) if paths then drawFlow(gui, n, pr, paths) else warn("highlighter: no solution found") end end) ------------------------------------------------------------ shared overlay local function makeOverlay(gui, board, onFrame) local overlay = Instance.new("Frame") overlay.Name = "SolutionOverlay" overlay.BackgroundTransparency = 1 overlay.ZIndex = 100 overlay.Parent = gui local conn conn = RunService.RenderStepped:Connect(function() if not gui.Parent then conn:Disconnect() return end local p = board.AbsolutePosition - gui.AbsolutePosition overlay.Position = UDim2.fromOffset(p.X, p.Y) overlay.Size = UDim2.fromOffset(board.AbsoluteSize.X, board.AbsoluteSize.Y) if onFrame then onFrame(overlay.AbsoluteSize) end end) return overlay end local function waitBoard(gui) for _ = 1, 40 do local b = findBoard(gui.Container) if b then return b end task.wait(0.05) end end ------------------------------------------------------------ Connect local CB = require(RS.Modules.Minigames.ConnectBoard) hook("ConnectClientMinigame", function(s, gui) local P = s.Network.Properties local blobs = P:Get("Blobs") local layout = CB.Layout(#blobs, P:Get("Along")) local cb = CB.new(blobs) local board = waitBoard(gui) if not board then return end local lines = {} local overlay = makeOverlay(gui, board, function(S) for _, l in ipairs(lines) do local a, b = l.a * S, l.b * S local d = b - a l.f.Size = UDim2.fromOffset(d.Magnitude, 8) l.f.Position = UDim2.fromOffset((a.X + b.X) / 2, (a.Y + b.Y) / 2) l.f.Rotation = math.deg(math.atan2(d.Y, d.X)) end end) local function pos(i) -- side 1=top 2=right 3=bottom 4=left (guess, flip here if wrong) local l = layout[i] if l.Side == 1 then return Vector2.new(l.Along, 0) elseif l.Side == 2 then return Vector2.new(1, l.Along) elseif l.Side == 3 then return Vector2.new(l.Along, 1) else return Vector2.new(0, l.Along) end end for i = 1, #blobs do local m = cb:GetMate(i) if m and i < m then local c = typeof(blobs[i]) == "Color3" and blobs[i] or Color3.fromHSV((blobs[i] * 0.137) % 1, 0.85, 1) local f = Instance.new("Frame") f.AnchorPoint = Vector2.new(0.5, 0.5) f.BorderSizePixel = 0 f.BackgroundColor3 = c f.BackgroundTransparency = ALPHA f.ZIndex = 100 f.Parent = overlay lines[#lines + 1] = { f = f, a = pos(i), b = pos(m) } end end end) ------------------------------------------------------------ Lock local LB = require(RS.Modules.Minigames.LockBoard) hook("LockClientMinigame", function(s, gui) local P = s.Network.Properties local shadow = LB.new(P:Get("Config")) local function sync(st) if typeof(st) == "table" and typeof(st.Presses) == "number" and st.Presses >= shadow.State.Presses then shadow:Apply(st) end end sync(P:Get("State")) P:Connect("State", sync) local board = waitBoard(gui) if not board then return end local flash = Instance.new("Frame") flash.Size = UDim2.fromScale(1, 1) flash.BackgroundColor3 = Color3.fromRGB(0, 255, 0) flash.BackgroundTransparency = 1 flash.BorderSizePixel = 0 flash.ZIndex = 100 local dot = Instance.new("Frame") -- target marker (0 = up, clockwise; flip if wrong) dot.Size = UDim2.fromOffset(16, 16) dot.AnchorPoint = Vector2.new(0.5, 0.5) dot.BackgroundColor3 = Color3.fromRGB(255, 255, 0) dot.BackgroundTransparency = ALPHA dot.ZIndex = 101 local c = Instance.new("UICorner"); c.CornerRadius = UDim.new(1, 0); c.Parent = dot local overlay = makeOverlay(gui, board, function(S) local a = math.rad(shadow.State.Target) local r = S.X * 0.4 dot.Position = UDim2.fromOffset(S.X / 2 + math.sin(a) * r, S.Y / 2 - math.cos(a) * r) local on = shadow:IsOnTarget(shadow:AngleAt(workspace:GetServerTimeNow())) flash.BackgroundTransparency = on and ALPHA or 1 end) flash.Parent = overlay dot.Parent = overlay end) print("Minigame highlighter loaded (Flow)")