
Key Required
Auto
Lua Script•136 lines (3770 chars)
print("LsrS From ScriptBlox")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local questionLabel = LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("GameStage"):WaitForChild("inGameGui"):WaitForChild("Frame"):WaitForChild("CurrentColor"):WaitForChild("ColorName")
local function trim(s)
return (tostring(s):gsub("^%s+", ""):gsub("%s+$", ""))
end
local function isInteger(n)
return math.abs(n - math.floor(n)) < 1e-9
end
local function toNumericString(s)
local n = tonumber(trim(s))
if n == nil then return trim(s) end
if isInteger(n) then return tostring(math.floor(n)) end
local t = string.format("%.6f", n):gsub("0+$", ""):gsub("%.$", "")
return t
end
local function calc(exprText)
local s = trim(exprText)
s = s:gsub("×", "*"):gsub("x", "*"):gsub("X", "*"):gsub("÷", "/")
local a, op, b = s:match("^(-?%d+%.?%d*)%s*([%+%-%*/])%s*(-?%d+%.?%d*)$")
if not a then return nil end
local n1, n2 = tonumber(a), tonumber(b)
if not n1 or not n2 then return nil end
local result
if op == "+" then result = n1 + n2
elseif op == "-" then result = n1 - n2
elseif op == "*" then result = n1 * n2
elseif op == "/" then if n2==0 then return nil end result = n1 / n2 end
return toNumericString(result)
end
local function getSquare(map, i)
local s = map:FindFirstChild("Square"..i)
if s then return s end
local container = map:FindFirstChild("Square")
if container then s = container:FindFirstChild(tostring(i)) end
return s
end
local function getBlock(square, j)
local b = square:FindFirstChild("Block"..j)
if b then return b end
local container = square:FindFirstChild("Block")
if container then b = container:FindFirstChild(tostring(j)) end
return b
end
local highlightParts = {}
local function addHighlight(part)
if highlightParts[part] then return end
local sb = Instance.new("SelectionBox")
sb.Name = "AnswerHighlight"
sb.Adornee = part
sb.LineThickness = 0.1
sb.SurfaceTransparency = 0.5
sb.Parent = part
highlightParts[part] = sb
end
local function removeHighlight(part)
if highlightParts[part] then
highlightParts[part]:Destroy()
highlightParts[part] = nil
end
end
local function scanAndHighlight(answerStr)
local map = workspace:FindFirstChild("GameStage")
map = map and map:FindFirstChild("Map")
if not map then return end
for i = 1, 3 do
local square = getSquare(map,i)
if square then
for j = 1,64 do
local block = getBlock(square,j)
if block then
local part = block:FindFirstChild("Part")
if part then removeHighlight(part) end
end
end
end
end
for i = 1, 3 do
local square = getSquare(map,i)
if square then
for j = 1,64 do
local block = getBlock(square,j)
if block then
local part = block:FindFirstChild("Part")
if part then
local gui = part:FindFirstChild("SurfaceGui")
if gui then
local lbl = gui:FindFirstChild("TextLabel")
if lbl and typeof(lbl.Text)=="string" then
local lblVal = toNumericString(lbl.Text)
if lblVal == answerStr then addHighlight(part) end
end
end
end
end
end
end
end
end
local function refresh()
local q = questionLabel and questionLabel.Text
local ans = q and calc(q)
if ans then scanAndHighlight(ans)
else
local gs = workspace:FindFirstChild("GameStage")
local map = gs and gs:FindFirstChild("Map")
if map then
for i = 1,3 do
local square = getSquare(map,i)
if square then
for j = 1,64 do
local block = getBlock(square,j)
if block and block:FindFirstChild("Part") then removeHighlight(block.Part) end
end
end
end
end
end
end
questionLabel:GetPropertyChangedSignal("Text"):Connect(refresh)
task.spawn(function()
while task.wait(0.03) do
refresh()
for part,sb in pairs(highlightParts) do
if sb then
local t = tick()*2
sb.SurfaceTransparency = 0.3 + 0.5*math.abs(math.sin(t))
local hue = (tick()*60%360)/360
sb.Color3 = Color3.fromHSV(hue,1,1)
sb.SurfaceColor3 = Color3.fromHSV(hue,1,1)
end
end
end
end)
refresh()Features & Information
aUto
open
Beta
Community Comments (0)
No comments yet for this script.
