-- Load Rayfield Gen 2 local Rayfield = loadstring(game:HttpGet("https://sirius.menu/gen2"))() -- Create Window local window = Rayfield:CreateWindow({ name = "Auto Perfect & Farm", subtitle = "Rayfield Gen2", }) -- Create Tab local tab = window:CreateTab({ name = "Main Controls", icon = 93364949241311 }) local player = game:GetService("Players").LocalPlayer local replicatedStorage = game:GetService("ReplicatedStorage") -- Helper function to teleport character to Blast Zone local function teleportToBlastZone() local character = player.Character or player.CharacterAdded:Wait() local hrp = character:FindFirstChild("HumanoidRootPart") local zones = workspace:FindFirstChild("Zones") local blastZone = zones and zones:FindFirstChild("BlastZone") local blastArea = blastZone and (blastZone:FindFirstChild("BlastArea") or blastZone:FindFirstChild("SafeArea") or blastZone:FindFirstChild("Part")) if hrp and blastArea and blastArea:IsA("BasePart") then hrp.CFrame = blastArea.CFrame + Vector3.new(0, 5, 0) return true end return false end -- 1. Auto Perfect Toggle tab:CreateToggle({ name = "Auto Perfect", callback = function(value) player:SetAttribute("GP_AutoPerfect", value) window:Notify({ title = "Auto Perfect", content = value and "Auto-Perfect ENABLED" or "Auto-Perfect DISABLED" }) end, }) -- Keep attribute sync secure player:GetAttributeChangedSignal("GP_AutoPerfect"):Connect(function() local enabled = player:GetAttribute("GP_AutoPerfect") == true end) -- 2. Manual Teleport Button tab:CreateButton({ name = "Teleport to Blast Zone", callback = function() if teleportToBlastZone() then window:Notify({title = "Teleport", content = "Teleported to Blast Zone!"}) else window:Notify({title = "Error", content = "Could not locate Blast Zone."}) end end, }) -- 3. Auto Teleport to Blast Zone when Brainrot received local autoTpBrainrot = false local connections = {} local function checkAndTeleport(child) if not autoTpBrainrot then return end local itemName = child.Name:lower() if string.find(itemName, "brainrot") or string.find(itemName, "brain rot") then task.wait(0.1) if teleportToBlastZone() then window:Notify({ title = "Brainrot Obtained!", content = "Teleported to Blast Zone with: " .. child.Name }) end end end tab:CreateToggle({ name = "Auto TP on Brainrot", callback = function(value) autoTpBrainrot = value for _, conn in ipairs(connections) do conn:Disconnect() end connections = {} if autoTpBrainrot then window:Notify({title = "Auto TP Enabled", content = "Listening for Brainrot items..."}) local backpack = player:WaitForChild("Backpack") table.insert(connections, backpack.ChildAdded:Connect(checkAndTeleport)) if player.Character then table.insert(connections, player.Character.ChildAdded:Connect(checkAndTeleport)) end table.insert(connections, player.CharacterAdded:Connect(function(char) table.insert(connections, char.ChildAdded:Connect(checkAndTeleport)) end)) end end, }) -- 4. Auto Equip & Place Best Brainrot (Stops when base is full) local autoPlace = false tab:CreateToggle({ name = "Auto Equip & Place Best", callback = function(value) autoPlace = value if autoPlace then window:Notify({title = "Auto Place Enabled", content = "Walk over your base! Will stop when full."}) task.spawn(function() local timeWithoutPlacing = 0 while autoPlace do task.wait(0.1) local character = player.Character local humanoid = character and character:FindFirstChild("Humanoid") local backpack = player:FindFirstChild("Backpack") local playerGui = player:FindFirstChild("PlayerGui") if not character or not humanoid or not backpack or not playerGui then continue end -- Find the best Brainrot in Backpack local bestItem = nil local highestStat = -1 for _, item in ipairs(backpack:GetChildren()) do if item:IsA("Tool") and not string.find(item.Name:lower(), "potion") and not string.find(item.Name:lower(), "book") then local stat = item:GetAttribute("Multiplier") or item:GetAttribute("Power") or item:GetAttribute("Cash") or item:GetAttribute("Level") or 1 if stat > highestStat then highestStat = stat bestItem = item end end end -- Stop if inventory is empty if not bestItem then window:Notify({title = "Inventory Empty", content = "No more Brainrots left to place! Stopping."}) autoPlace = false break end humanoid:EquipTool(bestItem) local placedThisTick = false -- Click popup "Place" button automatically if firesignal then for _, element in ipairs(playerGui:GetDescendants()) do if element:IsA("GuiButton") and element.Visible then local text = element:IsA("TextButton") and element.Text:lower() or "" local name = element.Name:lower() for _, child in ipairs(element:GetChildren()) do if child:IsA("TextLabel") then text = text .. " " .. child.Text:lower() end end if string.find(name, "place") or string.find(text, "place") then pcall(function() firesignal(element.MouseButton1Click) firesignal(element.Activated) end) placedThisTick = true end end end end if placedThisTick then timeWithoutPlacing = 0 task.wait(0.5) else timeWithoutPlacing = timeWithoutPlacing + 0.1 end -- Automatically stop if base is full (10 seconds with no place button detected) if timeWithoutPlacing >= 10 then window:Notify({ title = "Base Full!", content = "Could not place for 10 seconds. Base is full, turning off." }) autoPlace = false break end end end) end end, }) -- 5. Give All Boost Potions to Backpack tab:CreateButton({ name = "Get All Boost Potions", callback = function() pcall(function() local templates = replicatedStorage:FindFirstChild("Templates") local boostsFolder = templates and templates:FindFirstChild("Boosts") if boostsFolder then local backpack = player:FindFirstChild("Backpack") if backpack then for _, template in ipairs(boostsFolder:GetChildren()) do local clone = template:Clone() clone.Parent = backpack end window:Notify({title = "Success", content = "All boost potions added to your backpack!"}) end else window:Notify({title = "Error", content = "Could not locate Boosts templates folder."}) end end) end, }) -- 6. Auto-Use & Keep Potions Active (Fires server remotes and consumes/activates potions automatically) local autoPotionsActive = false tab:CreateToggle({ name = "Auto-Use & Loop Potions", callback = function(value) autoPotionsActive = value if autoPotionsActive then window:Notify({title = "Auto Potions Enabled", content = "Continuously activating and applying boost potions!"}) task.spawn(function() while autoPotionsActive do task.wait(2) pcall(function() local backpack = player:FindFirstChild("Backpack") local character = player.Character local humanoid = character and character:FindFirstChild("Humanoid") -- 1. Try firing any server remotes related to potions/boosts for _, remote in ipairs(replicatedStorage:GetDescendants()) do if remote:IsA("RemoteEvent") then local rName = remote.Name:lower() if (string.find(rName, "potion") or string.find(rName, "boost")) and (string.find(rName, "use") or string.find(rName, "buy") or string.find(rName, "activate")) then remote:FireServer("X2LuckPotion") remote:FireServer("X2CashPotion") remote:FireServer("X2BrainPotion") remote:FireServer("X2BlastPotion") remote:FireServer(1) remote:FireServer(2) remote:FireServer(3) remote:FireServer(4) end end end -- 2. Equip and activate potion tools from backpack so the game registers them if backpack and humanoid then for _, item in ipairs(backpack:GetChildren()) do if item:IsA("Tool") and string.find(item.Name:lower(), "potion") then humanoid:EquipTool(item) task.wait(0.2) item:Activate() end end end end) end end) else window:Notify({title = "Auto Potions Disabled", content = "Stopped auto-using potions."}) end end, })