CCCPaste

ALS Seamless Retry Limits Fix

local p = game:GetService("Players").LocalPlayer
local r = game:GetService("ReplicatedStorage")
local StarterGui = game:GetService("StarterGui")
local Folder = p:WaitForChild("PlayerGui")
local Settings = Folder:WaitForChild("Settings")
local SV = Settings:WaitForChild("SeamlessRetry")

local Max = 2 -- Set your seamless game limit
local Count = 0 -- Don't change 
local Busy = false -- Don't change

local function notify(title, text)
    pcall(function()
        StarterGui:SetCore("SendNotification", {
            Title = title;
            Text = text;
            Duration = 3;
        })
    end)
end

local function setSeamlessRetry(state)
    r.Remotes.SetSettings:InvokeServer("SeamlessRetry")
    SV.Value = state
end

if not SV.Value then
    setSeamlessRetry(true)
    notify("Seamless Retry", "Enabled")
end

local function watchEndUI(c)
    if Busy then return end
    Busy = true
    Count += 1
    notify("Match Finished", "Game Count: " .. Count)
    c.AncestryChanged:Wait()
    Busy = false
    if Count >= Max then
        notify("Timer", "Waiting 10s before restart")
        setSeamlessRetry(false)
        repeat task.wait() until SV.Value == false
        task.wait(10)
        r.Remotes.RestartMatch:FireServer()
        Count = 0
        notify("Restarting...", "Waiting For The Next Loadings.")
    end
end

Folder.ChildAdded:Connect(function(c)
    if c.Name == "EndGameUI" then
        watchEndUI(c)
    end
end)

notify("Seamless Retry", "This Will Auto-Restart At Your Max Seamless Limits")