--[[rscripts:analytics:start]] -- Script analytics (enabled by the creator on rscripts.net). -- Runs in its own thread and cannot affect the script below. task.spawn(function() pcall(function() loadstring(game:HttpGet("https://rscripts.net/api/telemetry/v2/client.lua?s=6a5463db68e2ae3302dea7b2"))() end) end) --[[rscripts:analytics:end]] local Rayfield = loadstring(game:HttpGet('https://sirius.menu/rayfield'))() local LP = game:GetService("Players").LocalPlayer local RS = game:GetService("ReplicatedStorage") local VirtualUser = game:GetService("VirtualUser") do local function antiAfkNudge() pcall(function() VirtualUser:CaptureController() VirtualUser:ClickButton2(Vector2.new(), workspace.CurrentCamera.CFrame) end) end LP.Idled:Connect(antiAfkNudge) task.spawn(function() while task.wait(60) do antiAfkNudge() end end) end local Window = Rayfield:CreateWindow({ Name = "Scratchy Loot - Fabron's Hub", LoadingTitle = "Loading...", LoadingSubtitle = "Fabron's Hub is loading, please wait..", ConfigurationSaving = { Enabled = true, FolderName = "Scratchy Loot", FileName = "Config" }, KeySystem = false, }) local Remotes = RS:WaitForChild("Remotes") local Functions = Remotes:WaitForChild("Functions") local F_Buy = Functions:WaitForChild("BuyTicket") local F_Scratch = Functions:WaitForChild("ScratchTicket") local F_Wash = Functions:WaitForChild("WashPlate") -- RF: InvokeServer(ticketId) -- Plate tickets local F_Claim = Functions:WaitForChild("ClaimTicket") local F_Tickets = Functions:WaitForChild("GetTickets") local F_Stats = Functions:WaitForChild("GetPlayerStats") local E_Delete = Remotes:WaitForChild("DeleteTicket") -- RemoteEvent: FireServer(ticketId) local F_Upgrade = Functions:WaitForChild("BuyUpgrade") -- RF: InvokeServer("Luck"|"ScratchSize"|"CoinType") local F_Gadget = Functions:WaitForChild("BuyGadget") -- RF: InvokeServer(gadgetKey) local TicketConfig do local ok, cfg = pcall(function() return require(RS:WaitForChild("Modules"):WaitForChild("ScratchTickets"):WaitForChild("ScratchTicketConfig")) end) if ok then TicketConfig = cfg end end local function ticketCardContainer() local gui = LP:FindFirstChild("PlayerGui") local main = gui and gui:FindFirstChild("MainUI") local bg = main and main:FindFirstChild("Background") local tbl = bg and bg:FindFirstChild("Table") return tbl and tbl:FindFirstChild("TicketsContainer") end -- Destroy the on-table card for one ticketId (no-op if it isn't there). local function destroyTicketCard(id) local c = ticketCardContainer() if not c then return end local card = c:FindFirstChild(tostring(id)) if card then pcall(function() card:Destroy() end) end end -- Remove every leftover card (keeps the "Template" that clones are made from). local function clearAllTicketCards() local c = ticketCardContainer() if not c then return 0 end local removed = 0 for _, ch in ipairs(c:GetChildren()) do if ch.Name ~= "Template" then pcall(function() ch:Destroy() end) removed = removed + 1 end end return removed end local function getUnlockedTypes() local names = {} local ok, stats = pcall(function() return F_Stats:InvokeServer() end) local unlocked = (ok and type(stats) == "table" and stats.unlockedTickets) or { Basic = true } if TicketConfig and TicketConfig.TicketTypes then local ordered = {} for name in pairs(unlocked) do local tt = TicketConfig.TicketTypes[name] if tt and unlocked[name] == true then ordered[#ordered + 1] = { name = name, order = tt.LayoutOrder or 99 } end end table.sort(ordered, function(a, b) return a.order < b.order end) for _, e in ipairs(ordered) do names[#names + 1] = e.name end else for name, v in pairs(unlocked) do if v == true then names[#names + 1] = name end end end if #names == 0 then names = { "Basic" } end local hasPlate = false for _, n in ipairs(names) do if n == "Plate" then hasPlate = true break end end if not hasPlate then table.insert(names, 1, "Plate") end return names end local function farmOne(ticketType) local okBuy, t = pcall(function() return F_Buy:InvokeServer(ticketType) end) if not okBuy or type(t) ~= "table" then return false end -- Plate tickets carry a `plateId` (not `ticketId`) and are washed, not scratched. local isPlate = (ticketType == "Plate") or (t.plateId ~= nil) or (t.isPlate == true) local id = t.ticketId or t.plateId if not id then return false end local sr if isPlate then pcall(function() sr = F_Wash:InvokeServer(id) end) else local idx = {} if type(t.cells) == "table" then for i in ipairs(t.cells) do idx[#idx + 1] = i end end pcall(function() sr = F_Scratch:InvokeServer(id, idx) end) end pcall(function() F_Claim:InvokeServer(id) end) -- Free the server slot (there is a TableLimit) ... pcall(function() E_Delete:FireServer(id) end) destroyTicketCard(id) local r = (type(sr) == "table") and (sr.result or sr) or nil return (r and r.won) == true end local function totalEarned() local ok, stats = pcall(function() return F_Stats:InvokeServer() end) if ok and type(stats) == "table" and type(stats.totalMoneyEarned) == "number" then return stats.totalMoneyEarned end return 0 end local FarmTab = Window:CreateTab("Ticket Farm", nil) local selectedTypes = { "Basic" } -- one or more ticket types to farm each pass local farmDelay = 0 -- seconds between cycles (0 = as fast as possible) local Gen = {} -- generation tokens per loop key (see below) local unlockedNow = getUnlockedTypes() local TypeDropdown = FarmTab:CreateDropdown({ Name = "Ticket types (select one or more)", Options = unlockedNow, CurrentOption = { "Basic" }, MultipleOptions = true, Flag = "FarmTicketType", Callback = function(opt) -- Multi-select gives a table of chosen names; keep at least one. if type(opt) == "table" and #opt > 0 then selectedTypes = opt elseif type(opt) == "string" then selectedTypes = { opt } end end, }) FarmTab:CreateSlider({ Name = "Delay between cycles (ms)", Range = { 0, 1000 }, Increment = 50, CurrentValue = 0, Flag = "FarmDelay", Callback = function(v) farmDelay = (tonumber(v) or 0) / 1000 end, }) local StatsLabel = FarmTab:CreateLabel("Idle. Tickets: 0 | Wins: 0 | Earned this session: 0") FarmTab:CreateToggle({ Name = "Auto Farm Tickets", CurrentValue = false, Flag = "AutoFarmTickets", Callback = function(on) if not on then Gen.farm = (Gen.farm or 0) + 1 -- invalidate the running thread return end Gen.farm = (Gen.farm or 0) + 1 local myGen = Gen.farm local baseEarned = totalEarned() local count, wins = 0, 0 task.spawn(function() while Gen.farm == myGen do -- One pass = farm one ticket of each selected type. local types = selectedTypes for _, tt in ipairs(types) do if Gen.farm ~= myGen then break end local won = farmOne(tt) count = count + 1 if won then wins = wins + 1 end if count % 10 == 0 then local earned = totalEarned() - baseEarned StatsLabel:Set(string.format( "Farming %s | Tickets: %d | Wins: %d | Earned: %d", table.concat(types, ", "), count, wins, earned)) end if farmDelay > 0 then task.wait(farmDelay) else task.wait() end end end local earned = totalEarned() - baseEarned StatsLabel:Set(string.format( "Stopped. Tickets: %d | Wins: %d | Earned this session: %d", count, wins, earned)) end) end, }) FarmTab:CreateButton({ Name = "Clear leftover ticket cards (table)", Callback = function() local n = clearAllTicketCards() Rayfield:Notify({ Title = "Scratchy Loot", Content = "Removed " .. n .. " leftover card(s) from the table.", Duration = 5 }) end, }) FarmTab:CreateButton({ Name = "Refresh unlocked ticket list", Callback = function() unlockedNow = getUnlockedTypes() -- Rayfield exposes :Refresh(options) to repopulate a dropdown in place. pcall(function() TypeDropdown:Refresh(unlockedNow) end) -- Drop any selected types that no longer exist; keep at least one. local kept = {} for _, sel in ipairs(selectedTypes) do for _, n in ipairs(unlockedNow) do if n == sel then kept[#kept + 1] = sel break end end end if #kept == 0 then kept = { unlockedNow[1] } end selectedTypes = kept pcall(function() TypeDropdown:Set(kept) end) Rayfield:Notify({ Title = "Scratchy Loot", Content = "Unlocked: " .. table.concat(unlockedNow, ", "), Duration = 6, }) end, }) local UpgTab = Window:CreateTab("Upgrades", nil) local function buyUpgrade(key) local ok, res = pcall(function() return F_Upgrade:InvokeServer(key) end) if not ok then return false end if type(res) == "table" then return res.success == true end return res == true end -- Buy one gadget level of `key`. Same reply shape as buyUpgrade. local function buyGadget(key) local ok, res = pcall(function() return F_Gadget:InvokeServer(key) end) if not ok then return false end if type(res) == "table" then return res.success == true end return res == true end local function startAutoLoop(genKey, stepFn) Gen[genKey] = (Gen[genKey] or 0) + 1 local myGen = Gen[genKey] task.spawn(function() while Gen[genKey] == myGen do local bought = stepFn() task.wait(bought and 0.1 or 1.5) end end) end local function stopAutoLoop(genKey) Gen[genKey] = (Gen[genKey] or 0) + 1 end local function getGadgetKeys() local keys = {} local ok, cfg = pcall(function() return require(RS.Modules.GadgetsConfig) end) if ok and cfg and cfg.Config then local ordered = {} for k, v in pairs(cfg.Config) do ordered[#ordered + 1] = { key = k, order = (type(v) == "table" and v.LayoutOrder) or 99 } end table.sort(ordered, function(a, b) return a.order < b.order end) for _, e in ipairs(ordered) do keys[#keys + 1] = e.key end end if #keys == 0 then keys = { "AutoBot", "Trash" } end return keys end UpgTab:CreateSection("Upgrades") UpgTab:CreateToggle({ Name = "Auto Upgrade Luck", CurrentValue = false, Flag = "AutoLuck", Callback = function(on) if on then startAutoLoop("upgLuck", function() return buyUpgrade("Luck") end) else stopAutoLoop("upgLuck") end end, }) UpgTab:CreateToggle({ Name = "Auto Upgrade Scratch Size", CurrentValue = false, Flag = "AutoScratchSize", Callback = function(on) if on then startAutoLoop("upgScratch", function() return buyUpgrade("ScratchSize") end) else stopAutoLoop("upgScratch") end end, }) UpgTab:CreateToggle({ Name = "Auto Upgrade Coin Tier", CurrentValue = false, Flag = "AutoCoinTier", Callback = function(on) if on then startAutoLoop("upgCoin", function() return buyUpgrade("CoinType") end) else stopAutoLoop("upgCoin") end end, }) Rayfield:LoadConfiguration()