local Rayfield = loadstring(game:HttpGet('https://sirius.menu/rayfield'))() local Players = game:GetService("Players") local RunService = game:GetService("RunService") local RS = game:GetService("ReplicatedStorage") local LP = Players.LocalPlayer -- ============================================================ -- REMOTES (confirmed from decompile) -- ============================================================ local Remotes = RS:WaitForChild("Remotes") local ClickRemote = Remotes:WaitForChild("ItemRemotes"):WaitForChild("Click") local AfkRemote = Remotes:WaitForChild("AfkRemotes"):WaitForChild("Afk") local PulledEvent = Remotes:WaitForChild("GachaRemotes"):WaitForChild("Pulled") -- ============================================================ -- GACHA MACHINES (confirmed from decompile attributes) -- Workspace.Containers.GachaContainer.* -- Each has ProximityPrompt with Cost + Amount attributes -- ============================================================ local GACHA_TIERS = { -- ordered most expensive first so getBestAffordableTier always picks the best { name="Master x10", machine="Master Gacha", cost=5000000000, amount=10 }, { name="Master x1", machine="Master Gacha", cost=500000000, amount=1 }, { name="Elite x10", machine="Elite Gacha", cost=50000000, amount=10 }, { name="Elite x1", machine="Elite Gacha", cost=5000000, amount=1 }, { name="Adept x10", machine="Adept Gacha", cost=2500000, amount=10 }, { name="Adept x1", machine="Adept Gacha", cost=250000, amount=1 }, { name="Novice x50", machine="Novice Gacha", cost=5000, amount=50 }, { name="Novice x5", machine="Novice Gacha", cost=500, amount=5 }, { name="Novice x1", machine="Novice Gacha", cost=100, amount=1 }, } -- ============================================================ -- CONFIG -- ============================================================ local CFG = { autoClick = false, autoRoll = false, afkMode = false, clickRate = 0.05, -- seconds between clicks (server may throttle faster) rollTier = "best", -- "best" = highest affordable, or tier name totalRolls = 0, totalClicks = 0, } -- ============================================================ -- HELPERS -- ============================================================ local function getMoney() local ls = LP:FindFirstChild("leaderstats") return ls and ls:FindFirstChild("Money") and ls.Money.Value or 0 end local function formatMoney(n) if n >= 1e9 then return string.format("$%.1fB", n/1e9) elseif n >= 1e6 then return string.format("$%.1fM", n/1e6) elseif n >= 1e3 then return string.format("$%.1fK", n/1e3) else return "$"..tostring(math.floor(n)) end end -- Find the ProximityPrompt on a gacha machine by name and amount -- FIX: decompile shows multiple Parts named "Novice Gacha" etc, each with -- different Amount/Cost attributes. Must iterate ALL children of GachaContainer -- and match by both name AND Amount attribute on the Part itself. local function getGachaPrompt(machineName, amount) local container = workspace:FindFirstChild("Containers") if not container then return nil end local gachaContainer = container:FindFirstChild("GachaContainer") if not gachaContainer then return nil end -- iterate all children, find the Part with matching name AND Amount attribute for _, part in ipairs(gachaContainer:GetChildren()) do if part.Name == machineName then local amt = part:GetAttribute("Amount") if amt == amount then -- find the ProximityPrompt inside this specific part for _, child in ipairs(part:GetChildren()) do if child:IsA("ProximityPrompt") then return child end end end end end return nil end -- Find the best gacha tier the player can afford -- Returns highest-value roll first local function getBestAffordableTier() local money = getMoney() -- Sort by cost descending to get best first for _, tier in ipairs(GACHA_TIERS) do if money >= tier.cost then return tier end end return nil end -- Teleport to a gacha machine local function teleportToMachine(machineName) local container = workspace:FindFirstChild("Containers") if not container then return end local gc = container:FindFirstChild("GachaContainer") if not gc then return end local machine = gc:FindFirstChild(machineName) if not machine then return end local char = LP.Character local root = char and char:FindFirstChild("HumanoidRootPart") if not root then return end -- Teleport to in front of machine local pos = machine:IsA("BasePart") and machine.Position or Vector3.new(0, 5, 0) root.CFrame = CFrame.new(pos + Vector3.new(0, 3, 5)) end -- ============================================================ -- STATE -- ============================================================ local farming = false local lastClick = 0 local lastRoll = 0 local lastAfk = 0 local lastRollTier = "" local connections = {} -- ============================================================ -- PULL TRACKER (SERVER->CLIENT confirmed) -- Pulled.OnClientEvent fires with (itemData, rollType) -- ============================================================ local recentPulls = {} PulledEvent.OnClientEvent:Connect(function(itemData, rollType) pcall(function() if not farming then return end CFG.totalRolls += 1 local name = "?" if type(itemData) == "table" then name = itemData.Name or itemData.name or "?" elseif type(itemData) == "string" then name = itemData end table.insert(recentPulls, 1, name) if #recentPulls > 5 then table.remove(recentPulls) end end) end) -- ============================================================ -- FARM LOOP -- ============================================================ local function doFarm() local now = tick() -- Auto click (spam Click:FireServer()) if CFG.autoClick and now - lastClick >= CFG.clickRate then lastClick = now pcall(function() ClickRemote:FireServer() end) CFG.totalClicks += 1 end -- AFK mode (passive income boost) if CFG.afkMode and now - lastAfk >= 30 then lastAfk = now pcall(function() AfkRemote:FireServer(true) end) end -- Auto roll (every 0.5s check for affordable roll) if CFG.autoRoll and now - lastRoll >= 0.5 then lastRoll = now local tier = getBestAffordableTier() if tier then -- Only teleport if we changed tier if tier.name ~= lastRollTier then teleportToMachine(tier.machine) lastRollTier = tier.name task.wait(0.1) end local prompt = getGachaPrompt(tier.machine, tier.amount) if prompt then pcall(function() fireproximityprompt(prompt) end) end end end end -- ============================================================ -- RAYFIELD UI -- ============================================================ local Window = Rayfield:CreateWindow({ Name = "Just A RNG Game", LoadingTitle = "RNG Farm", LoadingSubtitle = "Auto Click + Auto Roll", ConfigurationSaving = { Enabled = false }, Discord = { Enabled = false }, KeySystem = false, }) local FarmTab = Window:CreateTab("Farm", "zap") local startBtn startBtn = FarmTab:CreateButton({ Name="▶ Start Farm", Callback=function() farming = not farming if farming then -- enable afk mode immediately if CFG.afkMode then pcall(function() AfkRemote:FireServer(true) end) end Rayfield:Notify({ Title = "Farm Started", Content = "Auto clicking and rolling", Duration = 2, }) else -- disable afk when stopping pcall(function() AfkRemote:FireServer(false) end) Rayfield:Notify({ Title = "Farm Stopped", Content = "AFK mode disabled", Duration = 2, }) end end, }) FarmTab:CreateToggle({ Name="Auto Click", CurrentValue=CFG.autoClick, Flag="autoClick", Callback=function(v) CFG.autoClick = v end, }) FarmTab:CreateToggle({ Name="Auto Roll (best gacha)", CurrentValue=CFG.autoRoll, Flag="autoRoll", Callback=function(v) CFG.autoRoll = v end, }) FarmTab:CreateToggle({ Name="AFK Mode (passive income)", CurrentValue=CFG.afkMode, Flag="afkMode", Callback=function(v) CFG.afkMode = v if farming then pcall(function() AfkRemote:FireServer(v) end) end end, }) FarmTab:CreateSlider({ Name="Click Speed (lower = faster)", Range={1, 20}, Increment=1, CurrentValue=math.floor(CFG.clickRate * 100), Flag="clickRate", Callback=function(v) CFG.clickRate = v/100 end, }) FarmTab:CreateDivider() FarmTab:CreateButton({ Name="Manual: Novice x50 Roll ($5,000)", Callback=function() local prompt = getGachaPrompt("Novice Gacha", 50) if prompt then teleportToMachine("Novice Gacha") task.wait(0.1) pcall(function() fireproximityprompt(prompt) end) else Rayfield:Notify({Title="Error", Content="Could not find Novice Gacha", Duration=2}) end end, }) FarmTab:CreateButton({ Name="Manual: Adept x10 Roll ($2.5M)", Callback=function() local prompt = getGachaPrompt("Adept Gacha", 10) if prompt then teleportToMachine("Adept Gacha") task.wait(0.1) pcall(function() fireproximityprompt(prompt) end) else Rayfield:Notify({Title="Error", Content="Could not find Adept Gacha", Duration=2}) end end, }) FarmTab:CreateButton({ Name="Manual: Elite x10 Roll ($50M)", Callback=function() local prompt = getGachaPrompt("Elite Gacha", 10) if prompt then teleportToMachine("Elite Gacha") task.wait(0.1) pcall(function() fireproximityprompt(prompt) end) else Rayfield:Notify({Title="Error", Content="Could not find Elite Gacha", Duration=2}) end end, }) FarmTab:CreateButton({ Name="Manual: Master x10 Roll ($5B)", Callback=function() local prompt = getGachaPrompt("Master Gacha", 10) if prompt then teleportToMachine("Master Gacha") task.wait(0.1) pcall(function() fireproximityprompt(prompt) end) else Rayfield:Notify({Title="Error", Content="Could not find Master Gacha", Duration=2}) end end, }) -- INFO TAB local InfoTab = Window:CreateTab("Info", "info") local moneyLbl = InfoTab:CreateLabel("Money: --") local clicksLbl = InfoTab:CreateLabel("Clicks: 0") local rollsLbl = InfoTab:CreateLabel("Rolls: 0") local tierLbl = InfoTab:CreateLabel("Current tier: --") local pullLbl = InfoTab:CreateLabel("Last pull: --") local statusLbl = InfoTab:CreateLabel("Status: Idle") -- MAIN LOOP local conn = RunService.Heartbeat:Connect(function() if farming then pcall(doFarm) end end) table.insert(connections, conn) -- INFO UPDATE local lastInfo = 0 RunService.Heartbeat:Connect(function() local now = tick() if now - lastInfo < 0.25 then return end lastInfo = now pcall(function() local money = getMoney() moneyLbl:Set("Money: "..formatMoney(money)) clicksLbl:Set("Clicks this session: "..CFG.totalClicks) rollsLbl:Set("Rolls this session: "..CFG.totalRolls) local tier = getBestAffordableTier() if tier then tierLbl:Set("Best affordable: "..tier.name.." ("..formatMoney(tier.cost)..")") else tierLbl:Set("Best affordable: saving up...") end if #recentPulls > 0 then pullLbl:Set("Last pull: "..recentPulls[1]) end statusLbl:Set("Status: "..(farming and "🟢 Farming" or "🔴 Idle")) end) end) print("[RNG Farm] Loaded — press Start Farm to begin")