open source auto-gym script
Key Required

open source auto-gym script

[UPDATE] Shigakusubbsubb 1K views 1.5K executesUpdated Oct 3, 2026
Unrated
00
Lua Script•143 lines (4664 chars)
-- auto-gym script for shigaku, basically just presses q/e when it has to
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local VIM = game:GetService("VirtualInputManager")

local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")

local enabled = true
local RETRY_DELAY = 0.35 -- re-press if a box stays red this long
local keys = { Q = Enum.KeyCode.Q, E = Enum.KeyCode.E }
local wasRed = { Q = false, E = false }
local lastPress = { Q = 0, E = 0 }
local boxes = { Q = nil, E = nil }

local function isRed(c)
    return c.R > 0.6 and c.G < 0.4 and c.B < 0.4
end

local function isLetter(d, letter)
    if not d:IsA("GuiObject") then return false end
    if (d:IsA("TextLabel") or d:IsA("TextButton")) then
        local t = d.Text:gsub("%s", ""):upper()
        if t == letter then return true end
    end
    return d.Name:upper() == letter
end

local function visibleChain(d)
    local o = d
    while o and o ~= playerGui do
        if o:IsA("GuiObject") and not o.Visible then return false end
        if o:IsA("ScreenGui") and not o.Enabled then return false end
        o = o.Parent
    end
    return o == playerGui
end

-- find a visible Q, then a visible E inside the same container
local function locate()
    for _, q in ipairs(playerGui:GetDescendants()) do
        if isLetter(q, "Q") and visibleChain(q) then
            local anc = q.Parent
            for _ = 1, 6 do
                if not anc or anc == playerGui then break end
                for _, d in ipairs(anc:GetDescendants()) do
                    if d ~= q and isLetter(d, "E") and visibleChain(d) then
                        boxes.Q, boxes.E = q, d
                        return
                    end
                end
                anc = anc.Parent
            end
        end
    end
    boxes.Q, boxes.E = nil, nil
end

local function colorRed(o)
    if o:IsA("GuiObject") and o.BackgroundTransparency < 1 and isRed(o.BackgroundColor3) then
        return true
    end
    if (o:IsA("ImageLabel") or o:IsA("ImageButton")) and isRed(o.ImageColor3) then
        return true
    end
    return false
end

local function boxIsRed(obj)
    if not obj or not obj.Parent then return false end
    if colorRed(obj) then return true end
    local p = obj.Parent
    for _ = 1, 2 do
        if p and p ~= playerGui and colorRed(p) then return true end
        p = p and p.Parent
    end
    for _, c in ipairs(obj:GetChildren()) do
        if colorRed(c) then return true end
    end
    return false
end

local function press(letter, obj)
    lastPress[letter] = tick()
    if obj and obj:IsA("GuiButton") and getconnections then
        for _, c in ipairs(getconnections(obj.MouseButton1Click)) do pcall(c.Fire, c) end
        for _, c in ipairs(getconnections(obj.Activated)) do pcall(c.Fire, c) end
    end
    VIM:SendKeyEvent(true, keys[letter], false, game)
    task.wait(0.05)
    VIM:SendKeyEvent(false, keys[letter], false, game)
end

-- toggle button + status
local gui = Instance.new("ScreenGui")
gui.Name = "AutoQE"
gui.ResetOnSpawn = false
gui.Parent = (gethui and gethui()) or game:GetService("CoreGui")

local btn = Instance.new("TextButton")
btn.Size = UDim2.new(0, 150, 0, 44)
btn.Position = UDim2.new(0, 10, 0.5, 0)
btn.BackgroundColor3 = Color3.fromRGB(40, 160, 70)
btn.TextColor3 = Color3.new(1, 1, 1)
btn.Font = Enum.Font.GothamBold
btn.TextSize = 12
btn.Text = "Auto QE: ON"
btn.Active = true
btn.Draggable = true
btn.Parent = gui
Instance.new("UICorner", btn)

btn.MouseButton1Click:Connect(function()
    enabled = not enabled
    btn.BackgroundColor3 = enabled and Color3.fromRGB(40, 160, 70) or Color3.fromRGB(170, 50, 50)
end)

local lastScan = 0
RunService.Heartbeat:Connect(function()
    if not enabled then btn.Text = "Auto QE: OFF" return end

    -- rescan if boxes are missing OR no longer visible (hidden UI counts as gone)
    local stale = not boxes.Q or not boxes.E
        or not boxes.Q.Parent or not boxes.E.Parent
        or not visibleChain(boxes.Q) or not visibleChain(boxes.E)
    if stale and tick() - lastScan > 0.25 then
        lastScan = tick()
        locate()
        wasRed.Q, wasRed.E = false, false
    end

    local status = {}
    for letter in pairs(keys) do
        local obj = boxes[letter]
        local red = boxIsRed(obj)
        status[letter] = obj and (red and "red" or "--") or "none"
        if red and (not wasRed[letter] or tick() - lastPress[letter] > RETRY_DELAY) then
            task.spawn(press, letter, obj)
        end
        wasRed[letter] = red
    end
    btn.Text = ("Auto QE: ON\nQ:%s  E:%s"):format(status.Q, status.E)
end)

Features & Information

auto press q/e for lazy bums basically all there is to the script
#shigaku#keyless#open source

Community Comments (0)

No comments yet for this script.