[LIMITED]  [Murderers vs Sheriffs]
Keyless

[LIMITED] [Murderers vs Sheriffs]

WEAPON DUELS1kin1kin 668 views 554 executesUpdated Oct 18, 2026
5.0/ 5(1 votes)
10100% Positive
Lua Script•104 lines (4497 chars)
-- Opens owned cases, including case rewards, until inventory is empty.
local OPEN_LIMIT = math.huge
local INTERVAL = 10
local TIMEOUT = 20
local env = getgenv()
assert(game.PlaceId == 82983707799188, "Unexpected place.")
assert(not env.WeaponDuelsCasesRunning, "Opener already running.")
local RS = game:GetService("ReplicatedStorage")
local R = RS:WaitForChild("Remotes", 10)
assert(R and R:FindFirstChild("Crate") and R:FindFirstChild("Inventory"), "Interface missing.")
local definitions = require(RS.Database.Modules.Crate)
local Http = game:GetService("HttpService")
local report = {status="running",sent=0,verified=0,rewards={}}
env.WeaponDuelsCaseReport = report
env.WeaponDuelsCasesRunning = true
env.WeaponDuelsCasesStop = false
local active, unexpected, connection

local function snapshot()
    local done, ok, result = false, false, nil
    task.spawn(function()
        ok, result = pcall(function() return R.Inventory.GetInventory:InvokeServer() end)
        done = true
    end)
    local deadline = os.clock() + TIMEOUT
    repeat task.wait(0.1) until done or os.clock() >= deadline
    assert(done and ok and type(result)=="table" and type(result.Crate)=="table", "Inventory query failed.")
    local copy = {}
    for name,n in pairs(result.Crate) do
        assert(type(n)=="number" and n>=0 and n<math.huge and n%1==0, "Invalid count.")
        copy[name]=n
    end
    return copy
end

local function matches(before, after, result)
    local expected = table.clone(before)
    expected[result.case] = (expected[result.case] or 0)-1
    if definitions[result.reward] then
        local d = definitions[result.case]
        local item = d and d.Dictionary and d.Items[result.reward]
        local amount = type(item)=="table" and (item.Amount or 1) or 1
        expected[result.reward]=(expected[result.reward] or 0)+amount
        result.awardedCases=amount
    end
    for name,n in pairs(expected) do if (after[name] or 0)~=n then return false end end
    for name,n in pairs(after) do if (expected[name] or 0)~=n then return false end end
    return true
end

local ok, err = xpcall(function()
    connection=R.Crate.OnClientEvent:Connect(function(reward,name,chance)
        if not active or active.result or name~=active.name or type(reward)~="string" then
            unexpected=true
            return
        end
        active.result={case=name,reward=reward,chance=tonumber(chance)}
    end)
    local nextAllowed = os.clock() + INTERVAL
    local lastName = ""
    while report.verified < OPEN_LIMIT and not env.WeaponDuelsCasesStop do
        while os.clock()<nextAllowed and not env.WeaponDuelsCasesStop do task.wait(0.2) end
        if env.WeaponDuelsCasesStop then break end
        assert(not unexpected, "Unrelated opening detected; queue stopped.")
        local before=snapshot()
        local names={}
        for name,n in pairs(before) do if n>0 then table.insert(names,name) end end
        table.sort(names)
        report.remaining=before
        if #names==0 then report.status="complete"; return end
        local name=names[1]
        for _,candidate in ipairs(names) do
            if candidate>lastName then name=candidate; break end
        end
        lastName=name
        active={name=name}
        report.sent+=1
        R.Crate:FireServer(name)
        nextAllowed=os.clock()+INTERVAL
        local deadline=os.clock()+TIMEOUT
        repeat task.wait(0.1) until active.result or unexpected or os.clock()>=deadline
        assert(not unexpected, "Unexpected result; stopped.")
        assert(active.result, "No server acknowledgment; stopped without retrying.")
        local result=active.result
        local after
        repeat
            after=snapshot()
            if matches(before,after,result) then break end
            task.wait(0.5)
        until os.clock()>=deadline
        assert(matches(before,after,result), "Inventory mismatch; stopped.")
        assert(not unexpected, "Extra result; stopped.")
        report.verified+=1
        report.remaining=after
        table.insert(report.rewards,result)
        active=nil
        print("[Cases] Verified",report.verified,name,"->",result.reward)
    end
    report.status=env.WeaponDuelsCasesStop and "stopped" or "test complete"
end,debug.traceback)
if connection then connection:Disconnect() end
env.WeaponDuelsCasesRunning=false
if not ok then report.status="error"; report.error=tostring(err); warn(report.error) end
print("[Cases] Queue summary",Http:JSONEncode(report))

Features & Information

macro/auto open case

Community Comments (0)

No comments yet for this script.

More Scripts for WEAPON DUELS