Advertisement
suramraja1

dwea

Jun 9th, 2025 (edited)
407
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 145.09 KB | None | 0 0
  1. -- SERVICES & MODULES
  2. local Players             = game:GetService("Players")
  3. local CollectionService   = game:GetService("CollectionService")
  4. local ReplicatedStorage   = game:GetService("ReplicatedStorage")
  5.  
  6. local Remotes             = require(ReplicatedStorage.Modules.Remotes)
  7. local GetFarm             = require(ReplicatedStorage.Modules.GetFarm)
  8. local InventoryService    = require(ReplicatedStorage.Modules.InventoryService)
  9. local sellRemote          = ReplicatedStorage
  10.                             :WaitForChild("GameEvents")
  11.                             :WaitForChild("Sell_Inventory")
  12. local sell_One_Remote     = ReplicatedStorage
  13.                             :WaitForChild("GameEvents")
  14.                             :WaitForChild("Sell_Item")
  15. local CalculatePetValue   = require(ReplicatedStorage.Modules:WaitForChild("CalculatePetValue"))
  16. local CalculatePlantValue = require(ReplicatedStorage.Modules:WaitForChild("CalculatePlantValue"))
  17. local MutationHandler     = require(ReplicatedStorage.Modules:WaitForChild("MutationHandler"))
  18. local ActivePetsService   = require(ReplicatedStorage.Modules.PetServices.ActivePetsService)
  19. local PetConfig           = require(ReplicatedStorage.Data.PetRegistry.PetConfig)
  20.  
  21.  
  22. -- PLAYER & FARM ROOT
  23. local player   = Players.LocalPlayer
  24. local farmRoot = GetFarm(player)
  25.  
  26.  
  27. local HttpService = game:GetService("HttpService")
  28. local webhookUrl  = "https://discord.com/api/webhooks/1371732167499186206/cAHDH567wnjAb7oncu7Hn5OsekL9GquwrFxarRJD-zz7jkFoM8y9qFslznQZhAX7HTT5"  -- replace with your Discord webhook URL
  29.  
  30. local hasSpecialPlant = false
  31.  
  32. -- Add this variable near the other local variable declarations
  33. local noMorePlantsToDelete = false
  34.  
  35. local isAutoToggleUIEnabled = false
  36. local autoToggleUIThread = nil
  37.  
  38. local isAutoSellEnabled = false
  39. local autoSellThread    = nil
  40.  
  41. local isAutoSellOneByOneEnabled = false
  42. local autoSellOneByOneThread = nil
  43.  
  44. local isAutoFeedEnabled = false
  45. local autoFeedThread = nil
  46.  
  47. local isAutoSubmitHoneyEnabled = false
  48. local autoSubmitHoneyThread = nil
  49.  
  50. local isAutoCollectEnabled = false
  51. local autoCollectThread    = nil
  52.  
  53. local MIN_WEIGHT_BY_VARIANT = {
  54.     ["Normal"] = 50,
  55.     ["Gold"] = 40,
  56.     ["Rainbow"] = 30
  57. }
  58.  
  59. local DoNotCollect_Variants = {
  60.     ["Gold"] = false,
  61.     ["Rainbow"] = false
  62. }
  63.  
  64. local DoNotCollect_Mutations = {
  65.     ["Shocked"] = false,
  66.     ["Frozen"] = false,
  67.     ["Wet"] = false,
  68.     ["Chilled"] = false,
  69.     ["Twisted"] = false,
  70.     ["Choc"] = false,
  71.     ["Burnt"] = false,
  72.     ["Moonlit"] = false,
  73.     ["Bloodlit"] = false,
  74.     ["Celestial"] = false,
  75.     ["Zombified"] = false,
  76.     ["Pollinated"] = false,
  77.     ["HoneyGlazed"] = false
  78. }
  79.  
  80.  
  81. local isAutoPlaceEggEnabled = false
  82. local autoPlaceEggThread = nil
  83.  
  84. local eggIndex = {
  85.     ["Common Egg"] = true,
  86.     ["Uncommon Egg"] = true,
  87.     ["Rare Egg"] = true,
  88.     ["Legendary Egg"] = true,
  89.     ["Mythical Egg"] = true,
  90.     ["Bug Egg"] = true,
  91.     ["Night Egg"] = true,
  92.     ["Bee Egg"] = true
  93. }
  94.  
  95. local isAutoBuyEggEnabled = false
  96. local autoBuyEggThread = nil
  97.  
  98. local Buy_PetEggs = {
  99.     ["Common Egg"] = true,
  100.     ["Uncommon Egg"] = true,
  101.     ["Rare Egg"] = true,
  102.     ["Legendary Egg"] = true,
  103.     ["Mythical Egg"] = true,
  104.     ["Bug Egg"] = true,
  105.     ["Night Egg"] = true,
  106.     ["Bee Egg"] = true
  107.     -- Add/modify as needed
  108. }
  109.  
  110.  
  111. local Keep_Value = 2000000000 -- 2 billion
  112.  
  113. -- Add these tables for the Auto_Sell_Multiple function
  114. local DoNotSell_Variants = {
  115.     ["Gold"] = false,
  116.     ["Rainbow"] = false
  117. }
  118.  
  119. local DoNotSell_Mutations = {
  120.     ["Shocked"] = false,
  121.     ["Frozen"] = false,
  122.     ["Wet"] = false,
  123.     ["Chilled"] = false,
  124.     ["Twisted"] = false,
  125.     ["Choc"] = false,
  126.     ["Burnt"] = false,
  127.     ["Moonlit"] = false,
  128.     ["Bloodlit"] = false,
  129.     ["Celestial"] = false,
  130.     ["Zombified"] = false,
  131.     ["Pollinated"] = true,
  132.     ["HoneyGlazed"] = false
  133. }
  134.  
  135.  
  136. local isAutoFavoriteEnabled = false
  137. local autoFavoriteThread    = nil
  138.  
  139. local Favorite_Variants = {
  140.     ["Gold"] = false,
  141.     ["Rainbow"] = false
  142. }
  143.  
  144. local Favorite_Mutations = {
  145.     ["Shocked"] = false,
  146.     ["Frozen"] = false,
  147.     ["Wet"] = false,
  148.     ["Chilled"] = false,
  149.     ["Twisted"] = false,
  150.     ["Choc"] = false,
  151.     ["Burnt"] = false,
  152.     ["Moonlit"] = false,
  153.     ["Bloodlit"] = false,
  154.     ["Celestial"] = false,
  155.     ["Zombified"] = false,
  156.     ["Pollinated"] = false,
  157.     ["HoneyGlazed"] = false
  158. }
  159.  
  160.  
  161. local isSpecialPetDetectorEnabled = true  -- Default to enabled
  162. local specialPetDetectorThread = nil
  163. local petScreenGui = nil
  164. local specialPetDetectorInitialized = false
  165. local specialPetListToggle = {
  166.     ["Dragonfly"] = true,
  167.     ["Raccoon"] = true,
  168.     ["Queen Bee"] = true,
  169.     ["Red Fox"] = true
  170. }
  171.  
  172.  
  173. -- AUTO-SELL PET VARIABLES
  174. local isAutoSellPetEnabled = false
  175. local autoSellPetThread = nil
  176.  
  177. -- Maximum weight to sell (in KG)
  178. local MAX_PET_KG = 5  -- Adjust this value to your preference
  179.  
  180. -- Pet selling configuration based on actual pets in the game
  181. local Sell_Pets = {
  182.     -- Common Pets
  183.     ["Dog"] = true,
  184.     ["Golden Lab"] = true,
  185.     ["Bunny"] = true,
  186.     ["Black Bunny"] = true,
  187.     ["Cat"] = true,
  188.     ["Orange Tabby"] = true,
  189.     ["Deer"] = true,
  190.     ["Spotted Deer"] = true,
  191.     ["Chicken"] = true,
  192.     ["Rooster"] = true,
  193.     ["Pig"] = true,
  194.    
  195.     -- Uncommon/Rare Pets
  196.     ["Monkey"] = true,
  197.     ["Silver Monkey"] = true,
  198.     ["Turtle"] = true,
  199.     ["Cow"] = true,
  200.     ["Hedgehog"] = true,
  201.     ["Kiwi"] = false,
  202.     ["Mole"] = true,
  203.     ["Frog"] = true,
  204.     ["Echo Frog"] = false,
  205.     ["Bee"] = true,
  206.    
  207.     -- Legendary/Mythical/Divine Pets
  208.     ["Snail"] = true,
  209.     ["Giant Ant"] = true,
  210.     ["Red Giant Ant"] = true,
  211.     ["Sea Otter"] = true,
  212.     ["Caterpillar"] = true,
  213.     ["Praying Mantis"] = false,
  214.     ["Grey Mouse"] = true,
  215.     ["Brown Mouse"] = true,
  216.     ["Squirrel"] = true,
  217.     ["Blood Hedgehog"] = false,
  218.     ["Honey Bee"] = true,
  219.     ["Petal Bee"] = false,
  220.     ["Golden Bee"] = true,
  221.     ["Bear Bee"] = false,
  222.    
  223.     --Good Pet
  224.     ["Moon Cat"] = true,
  225.     ["Queen Bee"] = false,
  226.     ["Owl"] = false,
  227.     ["Night Owl"] = false,
  228.     ["Blood Owl"] = false,
  229.     ["Blood Kiwi"] = false,
  230.     ["Polar Bear"] = false,
  231.     ["Red Fox"] = false,
  232.     ["Raccoon"] = false,
  233.     ["Dragonfly"] = false,
  234.    
  235.  
  236.     --Un-Obtainable
  237.     ["Chicken Zombie"] = false,
  238.     ["Panda"] = false,
  239.     ["Firefly"] = false,
  240.     ["Red Dragon"] = false
  241. }
  242.  
  243.  
  244. local isAutoBuySeedEnabled = false
  245. local autoBuySeedThread = nil
  246.  
  247. -- Add this table after your other settings tables
  248. local Buy_Seeds = {
  249.     ["Carrot"] = false,
  250.     ["Strawberry"] = true,
  251.     ["Blueberry"] = true,
  252.     ["Orange Tulip"] = true,
  253.     ["Tomato"] = true,
  254.     ["Corn"] = true,
  255.     ["Daffodil"] = true,
  256.     ["Watermelon"] = true,
  257.     ["Pumpkin"] = true,
  258.     ["Apple"] = true,
  259.     ["Bamboo"] = false,
  260.     ["Coconut"] = true,
  261.     ["Cactus"] = true,
  262.     ["Dragon Fruit"] = true,
  263.     ["Mango"] = true,
  264.     ["Grape"] = true,
  265.     ["Mushroom"] = true,
  266.     ["Pepper"] = true,
  267.     ["Cacao"] = true
  268.     -- Add more seeds as needed
  269. }
  270.  
  271. local isAutoBuyGearEnabled = false
  272. local autoBuyGearThread = nil
  273.  
  274. -- Add this table after your other settings tables
  275. local Buy_GearShop = {
  276.     ["Favorite Tool"] = false,
  277.     ["Watering Can"] = true,
  278.     ["Recall Wrench"] = false,
  279.     ["Trowel"] = true,
  280.     ["Basic Sprinkler"] = true,
  281.     ["Advanced Sprinkler"] = true,
  282.     ["Godly Sprinkler"] = true,
  283.     ["Lightning Rod"] = true,
  284.     ["Master Sprinkler"] = true
  285.     -- Set to false for items you don't want to buy
  286. }
  287.  
  288.  
  289. local isAutoBuyHoneyShopEnabled = false
  290. local autoBuyHoneyShopThread = nil
  291.  
  292. -- Add this configuration table with the actual items from HoneyEventShopData
  293. local Buy_HoneyShop = {
  294.     -- Seeds and Seed Packs
  295.     ["Bee Egg"] = {buy = true, priority = 1},
  296.     ["Flower Seed Pack"] = {buy = true, priority = 2},
  297.     ["Honey Sprinkler"] = {buy = true, priority = 3},
  298.    
  299.     -- Gameplay Items
  300.     ["Nectarine"] = {buy = false, priority = 4},      -- This is "Nectarine Seed" in shop display
  301.     ["Hive Fruit"] = {buy = false, priority = 5},     -- This is "Hive Fruit Seed" in shop display
  302.     ["Bee Crate"] = {buy = false, priority = 6},
  303.    
  304.     -- Cosmetic Items
  305.     ["Honey Comb"] = {buy = false, priority = 7},
  306.     ["Bee Chair"] = {buy = false, priority = 8},
  307.     ["Honey Torch"] = {buy = false, priority = 9},
  308.     ["Honey Walkway"] = {buy = false, priority = 10}
  309. }
  310.  
  311.  
  312. local isAutoBuyEventEnabled = false
  313. local autoBuyEventThread = nil
  314.  
  315. -- Include ALL items from EventShopData.lua, regardless of DisplayInShop value
  316. local Buy_EventShop = {
  317.     -- Regular items (DisplayInShop=true)
  318.     ["Mysterious Crate"] = false,
  319.     ["Night Egg"] = true,
  320.     ["Night Seed Pack"] = true,
  321.     ["Blood Banana"] = true,
  322.     ["Moon Melon"] = true,
  323.     ["Star Caller"] = true,
  324.     ["Blood Hedgehog"] = false,
  325.     ["Blood Kiwi"] = true,
  326.     ["Blood Owl"] = false,
  327.    
  328.     -- Hidden items (DisplayInShop=false, but still purchasable)
  329.     ["Chocolate Carrot"] = true,
  330.     ["Red Lollipop"] = true,
  331.     ["Candy Sunflower"] = true,
  332.     ["Easter Egg"] = true,
  333.     ["Chocolate Sprinkler"] = true,
  334.     ["Candy Blossom"] = true
  335. }
  336.  
  337. -- AUTO-BUY TWILIGHT SHOP VARIABLES
  338. local isAutoBuyTwilightEnabled = false
  339. local autoBuyTwilightThread = nil
  340.  
  341. -- Items from NightEventShopData.lua
  342. local Buy_TwilightShop = {
  343.     ["Night Egg"] = true,
  344.     ["Night Seed Pack"] = true,
  345.     ["Twilight Crate"] = true,
  346.     ["Star Caller"] = true,
  347.     ["Moon Cat"] = true,
  348.     ["Celestiberry"] = true,  -- Celestiberry Seed
  349.     ["Moon Mango"] = true     -- Moon Mango Seed
  350. }
  351.  
  352.  
  353. -- Add these variables for Auto_Plant
  354. local isAutoPlantEnabled = false
  355. local autoPlantThread = nil
  356.  
  357.  
  358. local Plant_Seeds = {
  359.     ["Carrot"] = false,
  360.     ["Strawberry"] = false,
  361.     ["Blueberry"] = false,
  362.     ["Orange Tulip"] = false,
  363.     ["Tomato"] = false,
  364.     ["Corn"] = false,
  365.     ["Daffodil"] = false,
  366.     ["Watermelon"] = false,
  367.     ["Pumpkin"] = false,
  368.     ["Apple"] = false,
  369.     ["Bamboo"] = false,
  370.     ["Coconut"] = true,
  371.     ["Cactus"] = false,
  372.     ["Dragon Fruit"] = true,
  373.     ["Mango"] = true,
  374.     ["Grape"] = true,
  375.     ["Mushroom"] = true,
  376.     ["Pepper"] = true,
  377.     ["Cacao"] = true,
  378.     -- The following seeds might not be available in shop but included for completeness
  379.     ["Pineapple"] = false,
  380.     ["Raspberry"] = false,
  381.     ["Peach"] = false,
  382.     ["Papaya"] = false,
  383.     ["Banana"] = false,
  384.     ["Passionfruit"] = false,
  385.     ["Soul Fruit"] = false,
  386.     ["Cursed Fruit"] = false,
  387.     ["Succulent"] = false,
  388.     ["Cranberry"] = false,
  389.     ["Durian"] = false,
  390.     ["Eggplant"] = false,
  391.     ["Lotus"] = false,
  392.     ["Venus Fly Trap"] = false,
  393.     ["Pear"] = false,
  394.     ["Lemon"] = false,
  395.     ["Cherry Blossom"] = false,
  396.     ["Avocado"] = false,
  397.     ["Nightshade"] = false,
  398.     ["Glowshroom"] = false,
  399.     ["Mint"] = false,
  400.     ["Moonflower"] = false,
  401.     ["Starfruit"] = false,
  402.     ["Moonglow"] = false,
  403.     ["Moon Blossom"] = false,
  404.     ["Chocolate Carrot"] = false,
  405.     ["Red Lollipop"] = false,
  406.     ["Candy Sunflower"] = false,
  407.     ["Easter Egg"] = false,
  408.     ["Candy Blossom"] = false
  409. }
  410.  
  411.  
  412. local isAutoDeletePlantEnabled = false
  413. local autoDeletePlantThread = nil
  414.  
  415. local Delete_Plants = {
  416.  
  417.     ["Carrot"] = true,
  418.     ["Strawberry"] = true,
  419.     ["Blueberry"] = true,
  420.     ["Orange Tulip"] = true,
  421.     ["Tomato"] = true,
  422.     ["Corn"] = true,
  423.     ["Daffodil"] = true,
  424.     ["Watermelon"] = true,
  425.     ["Pumpkin"] = true,
  426.     ["Apple"] = true,
  427.     ["Bamboo"] = true,
  428.     ["Coconut"] = false,
  429.     ["Cactus"] = true,
  430.     ["Dragon Fruit"] = false,
  431.     ["Mango"] = false,
  432.     ["Grape"] = false,
  433.     ["Mushroom"] = false,
  434.     ["Pepper"] = false,
  435.     ["Cacao"] = false,
  436.     -- The following seeds might not be available in shop but included for completeness
  437.     ["Pineapple"] = true,
  438.     ["Raspberry"] = true,
  439.     ["Peach"] = true,
  440.     ["Papaya"] = true,
  441.     ["Banana"] = false,
  442.     ["Passionfruit"] = true,
  443.     ["Soul Fruit"] = false,
  444.     ["Cursed Fruit"] = false,
  445.     ["Succulent"] = false,
  446.     ["Cranberry"] = false,
  447.     ["Durian"] = false,
  448.     ["Eggplant"] = false,
  449.     ["Lotus"] = false,
  450.     ["Venus Fly Trap"] = false,
  451.     ["Pear"] = false,
  452.     ["Lemon"] = false,
  453.     ["Cherry Blossom"] = false,
  454.     ["Avocado"] = false,
  455.     ["Nightshade"] = false,
  456.     ["Glowshroom"] = false,
  457.     ["Mint"] = false,
  458.     ["Moonflower"] = false,
  459.     ["Starfruit"] = false,
  460.     ["Moonglow"] = false,
  461.     ["Moon Blossom"] = false,
  462.     ["Chocolate Carrot"] = false,
  463.     ["Red Lollipop"] = false,
  464.     ["Candy Sunflower"] = false,
  465.     ["Easter Egg"] = false,
  466.     ["Candy Blossom"] = false
  467. }
  468.  
  469.  
  470. local playerGui = player:WaitForChild("PlayerGui")
  471. local priceGui = Instance.new("ScreenGui")
  472. priceGui.Name        = "PriceCalculatorGui"
  473. priceGui.ResetOnSpawn = false
  474. priceGui.Parent      = playerGui
  475.  
  476. local priceFrame = Instance.new("Frame")
  477. priceFrame.Name                   = "PriceFrame"
  478. priceFrame.Size                   = UDim2.new(0, 350, 0, 200)
  479. priceFrame.AnchorPoint            = Vector2.new(0.5, 0)
  480. priceFrame.Position               = UDim2.new(0.1,85, 0, 0.0,1, 0)
  481. priceFrame.BackgroundColor3       = Color3.new(0, 0, 0)
  482. priceFrame.BackgroundTransparency = 0.9
  483. priceFrame.Parent                 = priceGui
  484.  
  485. local priceLabel = Instance.new("TextLabel")
  486. priceLabel.Name               = "PriceLabel"
  487. priceLabel.Size               = UDim2.new(1, -10, 1, -10)
  488. priceLabel.Position           = UDim2.new(0, 5, 0, 5)
  489. priceLabel.BackgroundTransparency = 1
  490. priceLabel.TextColor3         = Color3.new(1, 1, 1)
  491. priceLabel.TextScaled         = true
  492. priceLabel.TextWrapped        = true
  493. priceLabel.Font               = Enum.Font.SourceSansBold
  494. priceLabel.Text               = ""
  495. priceLabel.Parent             = priceFrame
  496.  
  497. local ignoreGear = {
  498.     ["Watering Can"]      = true,
  499.     ["Recall Wrench"]     = true,
  500.     ["Trowel"]            = true,
  501.     ["Basic Sprinkler"]   = true,
  502.     ["Advanced Sprinkler"]= true,
  503.     ["Godly Sprinkler"]   = true,
  504.     ["Lightning Rod"]     = true,
  505.     ["Master Sprinkler"]  = true,
  506. }
  507.  
  508. local function formatNumber(n)
  509.     local sign = (n < 0) and "-" or ""
  510.     local absn = math.abs(n)
  511.     local suffix = ""
  512.     if absn >= 1e12 then
  513.         n = n/1e12; suffix = "T"
  514.     elseif absn >= 1e9 then
  515.         n = n/1e9; suffix = "B"
  516.     elseif absn >= 1e6 then
  517.         n = n/1e6; suffix = "M"
  518.     end
  519.     local i = math.floor(math.abs(n))
  520.     local f = math.abs(n) - i
  521.     local frac = (f > 0) and ("%.2f"):format(f):sub(2) or ""
  522.     local s = tostring(i)
  523.     while true do
  524.         local count
  525.         s, count = s:gsub("^(-?%d+)(%d%d%d)", "%1,%2")
  526.         if count == 0 then break end
  527.     end
  528.     return sign .. s .. frac .. suffix
  529. end
  530.  
  531. local function updatePrice(tool)
  532.     if not tool or not tool:IsA("Tool") then
  533.         priceLabel.Text = ""
  534.         return
  535.     end
  536.     local t = tool:GetAttribute("ItemType")
  537.     if t == "Seed" then
  538.         priceLabel.Text = ""
  539.         return
  540.     end
  541.     if ignoreGear[tool.Name] then
  542.         priceLabel.Text = ""
  543.         return
  544.     end
  545.     if t == "Pet" then
  546.         priceLabel.Text = "Pet Price: " .. formatNumber(CalculatePetValue(tool))
  547.     else
  548.         priceLabel.Text = "Fruit Price: " .. formatNumber(CalculatePlantValue(tool))
  549.     end
  550. end
  551.  
  552. local function hookTool(tool)
  553.     if not tool:IsA("Tool") then return end
  554.     tool.Equipped:Connect(function()   updatePrice(tool) end)
  555.     tool.Unequipped:Connect(function() updatePrice(nil)   end)
  556. end
  557.  
  558. for _, tool in ipairs(player.Backpack:GetChildren()) do hookTool(tool) end
  559. player.Backpack.ChildAdded:Connect(hookTool)
  560. if player.Character then
  561.     for _, tool in ipairs(player.Character:GetChildren()) do hookTool(tool) end
  562. end
  563. player.CharacterAdded:Connect(function(char)
  564.     for _, tool in ipairs(char:GetChildren()) do hookTool(tool) end
  565. end)
  566.  
  567. -- Function to initialize and start the pet detector
  568. function Initialize_Special_Pet_Detector()
  569.     if specialPetDetectorInitialized then return end
  570.     specialPetDetectorInitialized = true
  571.    
  572.     -- Create GUI if it doesn't exist
  573.     if not petScreenGui then
  574.         petScreenGui = Instance.new("ScreenGui")
  575.         petScreenGui.Name = "SpecialPetDetectorScreen"
  576.         petScreenGui.ResetOnSpawn = false
  577.         petScreenGui.IgnoreGuiInset = true
  578.         petScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  579.         petScreenGui.DisplayOrder = 999
  580.        
  581.         -- Create green background
  582.         local frame = Instance.new("Frame")
  583.         frame.Size = UDim2.new(1, 0, 1, 0)
  584.         frame.BackgroundColor3 = Color3.fromRGB(0, 255, 0) -- Green
  585.         frame.BackgroundTransparency = 0
  586.         frame.BorderSizePixel = 0
  587.         frame.Name = "GreenScreen"
  588.         frame.Parent = petScreenGui
  589.        
  590.         -- Add title label
  591.         local titleLabel = Instance.new("TextLabel")
  592.         titleLabel.Size = UDim2.new(1, 0, 0, 60)
  593.         titleLabel.Position = UDim2.new(0, 0, 0.1, 0)
  594.         titleLabel.BackgroundTransparency = 1
  595.         titleLabel.Font = Enum.Font.SourceSansBold
  596.         titleLabel.TextSize = 40
  597.         titleLabel.TextWrapped = true
  598.         titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  599.         titleLabel.Text = "SPECIAL PET DETECTED"
  600.         titleLabel.TextStrokeTransparency = 0
  601.         titleLabel.TextStrokeColor3 = Color3.fromRGB(0, 0, 0)
  602.         titleLabel.Name = "TitleLabel"
  603.         titleLabel.Parent = frame
  604.        
  605.         -- Add pet list
  606.         local petListLabel = Instance.new("TextLabel")
  607.         petListLabel.Size = UDim2.new(0.8, 0, 0.5, 0)
  608.         petListLabel.Position = UDim2.new(0.1, 0, 0.25, 0)
  609.         petListLabel.BackgroundTransparency = 1
  610.         petListLabel.Font = Enum.Font.SourceSansBold
  611.         petListLabel.TextSize = 30
  612.         petListLabel.TextWrapped = true
  613.         petListLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  614.         petListLabel.Text = "Checking for pets..."
  615.         petListLabel.TextStrokeTransparency = 0
  616.         petListLabel.TextStrokeColor3 = Color3.fromRGB(0, 0, 0)
  617.         petListLabel.Name = "PetList"
  618.         petListLabel.Parent = frame
  619.        
  620.         petScreenGui.Parent = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui")
  621.     end
  622.    
  623.     -- Start background detection thread (only one)
  624.     if not specialPetDetectorThread then
  625.         specialPetDetectorThread = spawn(function()
  626.             while true do  -- Keep checking pets regardless of toggle (only visibility changes)
  627.                 pcall(function()
  628.                     local DataService = require(ReplicatedStorage.Modules.DataService)
  629.                     local playerData = DataService:GetData()
  630.                     local foundSpecialPet = false
  631.                     local detectedPets = {}
  632.                    
  633.                     if playerData and playerData.PetsData and playerData.PetsData.PetInventory and
  634.                        playerData.PetsData.PetInventory.Data then
  635.                         -- Loop through all pets in inventory
  636.                         for _, petData in pairs(playerData.PetsData.PetInventory.Data) do
  637.                             if petData and petData.PetType and specialPetListToggle[petData.PetType] then
  638.                                 foundSpecialPet = true
  639.                                 detectedPets[petData.PetType] = (detectedPets[petData.PetType] or 0) + 1
  640.                             end
  641.                         end
  642.                     end
  643.                    
  644.                     -- Update UI based on results
  645.                     if foundSpecialPet and petScreenGui then
  646.                         -- Only show if toggle is enabled
  647.                         if isSpecialPetDetectorEnabled then
  648.                             petScreenGui.Enabled = true
  649.                            
  650.                             -- Update pet list text
  651.                             local petListText = "Found Special Pets:\n\n"
  652.                             for petType, count in pairs(detectedPets) do
  653.                                 petListText = petListText .. petType .. " x" .. count .. "\n"
  654.                             end
  655.                            
  656.                             if petScreenGui and petScreenGui.GreenScreen and petScreenGui.GreenScreen.PetList then
  657.                                 petScreenGui.GreenScreen.PetList.Text = petListText
  658.                             end
  659.                         end
  660.                     else
  661.                         if petScreenGui then
  662.                             petScreenGui.Enabled = false
  663.                         end
  664.                     end
  665.                 end)
  666.                 task.wait(5)  -- Check every 5 seconds
  667.             end
  668.         end)
  669.     end
  670. end
  671.  
  672. -- This function ONLY toggles visibility, doesn't restart detection
  673. function Toggle_Pet_Screen_Visibility()
  674.     isSpecialPetDetectorEnabled = not isSpecialPetDetectorEnabled
  675.    
  676.     if petScreenGui then
  677.         petScreenGui.Enabled = isSpecialPetDetectorEnabled
  678.     end
  679.    
  680.     return isSpecialPetDetectorEnabled
  681. end
  682.  
  683. -- Add this T key toggle function with your other input listeners
  684. game:GetService("UserInputService").InputBegan:Connect(function(input, gameProcessed)
  685.     if gameProcessed then return end
  686.    
  687.     if input.KeyCode == Enum.KeyCode.T then
  688.         Toggle_Pet_Screen_Visibility()
  689.     end
  690. end)
  691.  
  692. -- This function is called by the main loop to start the detector once
  693. function Auto_Special_Pet_Detector()
  694.     if not specialPetDetectorInitialized then
  695.         Initialize_Special_Pet_Detector()
  696.     end
  697.     return isSpecialPetDetectorEnabled
  698. end
  699.  
  700. function Auto_ToggleUI()
  701.     isAutoToggleUIEnabled = not isAutoToggleUIEnabled
  702.    
  703.     if isAutoToggleUIEnabled then
  704.         autoToggleUIThread = spawn(function()
  705.             while isAutoToggleUIEnabled do
  706.                 pcall(function()
  707.                     -- Check and toggle Honey UI
  708.                     local honeyUI = game:GetService("Players").LocalPlayer.PlayerGui:FindFirstChild("Honey_UI")
  709.                     if honeyUI and honeyUI:FindFirstChild("Frame") and honeyUI.Frame.Visible == false then
  710.                         honeyUI.Frame.Visible = true
  711.                         task.wait(1)
  712.                         game:service'VirtualInputManager':SendKeyEvent(true, "ButtonR2", false, game)
  713.                     end
  714.                    
  715.                     -- Check and toggle Teleport UI elements
  716.                     local teleportUI = game:GetService("Players").LocalPlayer.PlayerGui:FindFirstChild("Teleport_UI")
  717.                     if teleportUI and teleportUI:FindFirstChild("Frame") then
  718.                         -- Toggle Gear visibility
  719.                         if teleportUI.Frame:FindFirstChild("Gear") and teleportUI.Frame.Gear.Visible == false then
  720.                             teleportUI.Frame.Gear.Visible = true
  721.                             task.wait(1)
  722.                             game:service'VirtualInputManager':SendKeyEvent(true, "ButtonR2", false, game)
  723.                         end
  724.                        
  725.                         -- Toggle Pets visibility
  726.                         if teleportUI.Frame:FindFirstChild("Pets") and teleportUI.Frame.Pets.Visible == false then
  727.                             teleportUI.Frame.Pets.Visible = true
  728.                             task.wait(1)
  729.                             game:service'VirtualInputManager':SendKeyEvent(true, "ButtonR2", false, game)
  730.                         end
  731.                     end
  732.                 end)
  733.                
  734.                 -- Check UI elements every 3 seconds
  735.                 task.wait(60)
  736.             end
  737.            
  738.             autoToggleUIThread = nil
  739.         end)
  740.     else
  741.         if autoToggleUIThread then
  742.             task.cancel(autoToggleUIThread)
  743.         end
  744.         autoToggleUIThread = nil
  745.     end
  746.    
  747.     return isAutoToggleUIEnabled
  748. end
  749.  
  750.  
  751. -- Create a function to check for special plants
  752. function CheckForSpecialPlants()
  753.     local playerPlot = GetFarm(player)
  754.    
  755.     if playerPlot and playerPlot:FindFirstChild("Important") and
  756.        playerPlot.Important:FindFirstChild("Plants_Physical") then
  757.        
  758.         for _, plant in ipairs(playerPlot.Important.Plants_Physical:GetChildren()) do
  759.             if plant.Name == "Candy Blossom" then -- can add more plants ( example if plant.Name == "Candy Blossom" or plant.Name == "Other Special Plant" then)            )
  760.                 hasSpecialPlant = true
  761.                 return true
  762.             end
  763.         end
  764.     end
  765.    
  766.     return false
  767. end
  768.  
  769. -- TOGGLE & RUN AUTO-COLLECT
  770. function Auto_Collect()
  771.     isAutoCollectEnabled = not isAutoCollectEnabled
  772.  
  773.     if isAutoCollectEnabled then
  774.         local cachedPrompts = {}
  775.         local scanTimer = 0
  776.         local isPaused = false
  777.        
  778.         -- Set up notification listener for inventory full
  779.         local notificationConnection
  780.         notificationConnection = game.ReplicatedStorage:WaitForChild("GameEvents").Notification.OnClientEvent:Connect(function(message)
  781.             if isAutoCollectEnabled and typeof(message) == "string" and
  782.                (message:find("Inventory is full") or message:find("Max backpack")) then
  783.                 -- Set paused flag and schedule resume after 10 seconds
  784.                 isPaused = true
  785.                 task.delay(10, function()
  786.                     isPaused = false
  787.                 end)
  788.             end
  789.         end)
  790.  
  791.         autoCollectThread = spawn(function()
  792.             while isAutoCollectEnabled do
  793.                 -- Skip collection if paused due to full inventory
  794.                 if not isPaused then
  795.                     pcall(function()
  796.                         -- only refresh prompts every 15 loops (~7.5s)
  797.                         scanTimer = scanTimer + 1
  798.                         if #cachedPrompts == 0 or scanTimer >= 15 then
  799.                             cachedPrompts = CollectionService:GetTagged("CollectPrompt")
  800.                             scanTimer = 0
  801.                         end
  802.  
  803.                         -- collect low-weight crops
  804.                         local toCollect = {}
  805.                         for _, prompt in ipairs(cachedPrompts) do
  806.                             if prompt:IsDescendantOf(farmRoot) then
  807.                                 local model = prompt.Parent and prompt.Parent.Parent
  808.                                 if model and model:IsA("Model") then
  809.                                     -- Get variant and check it's not excluded
  810.                                     local variant = model:FindFirstChild("Variant")
  811.                                     local variantValue = variant and variant.Value or "Normal"
  812.                                     if not DoNotCollect_Variants[variantValue] then
  813.                                        
  814.                                         -- Use MutationHandler to check mutations
  815.                                         local mutationString = ""
  816.                                         local success = pcall(function()
  817.                                             mutationString = MutationHandler:GetMutationsAsString(model)
  818.                                         end)
  819.                                        
  820.                                         -- Check if any mutation is in the exclusion list
  821.                                         local shouldCollect = true
  822.                                         if success and mutationString ~= "" then
  823.                                             for mutation, excluded in pairs(DoNotCollect_Mutations) do
  824.                                                 if excluded and mutationString:find(mutation) then
  825.                                                     shouldCollect = false
  826.                                                     break
  827.                                                 end
  828.                                             end
  829.                                         end
  830.                                        
  831.                                         -- Check weight and collect if appropriate
  832.                                         if shouldCollect then
  833.                                             local w = (model:FindFirstChild("Weight") and model.Weight.Value) or 0
  834.                                             local variantThreshold = MIN_WEIGHT_BY_VARIANT[variantValue]
  835.                                             if w <= variantThreshold then
  836.                                                 table.insert(toCollect, model)
  837.                                             end
  838.                                         end
  839.                                     end
  840.                                 end
  841.                             end
  842.                         end
  843.                         if #toCollect > 0 then
  844.                             for _, model in ipairs(toCollect) do
  845.                                 Remotes.Crops.Collect.send({model})
  846.                                 task.wait(0.1)
  847.                             end
  848.                         end
  849.                     end)
  850.                 end
  851.                 task.wait(1)
  852.             end
  853.            
  854.             -- Clean up notification connection
  855.             if notificationConnection then
  856.                 notificationConnection:Disconnect()
  857.             end
  858.            
  859.             autoCollectThread = nil
  860.         end)
  861.     else
  862.         autoCollectThread = nil
  863.     end
  864.  
  865.     return isAutoCollectEnabled
  866. end
  867.  
  868. -- TOGGLE & RUN AUTO-SELL
  869. --[[function Auto_Sell()
  870.     isAutoSellEnabled = not isAutoSellEnabled
  871.  
  872.     if isAutoSellEnabled then
  873.         -- Set up notification listener
  874.         local notificationConnection
  875.         notificationConnection = game.ReplicatedStorage:WaitForChild("GameEvents").Notification.OnClientEvent:Connect(function(message)
  876.             if isAutoSellEnabled and typeof(message) == "string" and
  877.                (message:find("Inventory is full") or message:find("Max backpack")) then
  878.                
  879.                 pcall(function()
  880.                     -- Ensure character and HRP exist
  881.                     local char = player.Character or player.CharacterAdded:Wait()
  882.                     local hrp = char:FindFirstChild("HumanoidRootPart")
  883.                     local humanoid = char:FindFirstChild("Humanoid")
  884.                     if not hrp or not humanoid then return end
  885.                    
  886.                     -- Find a sell stand
  887.                     local standsFolder = workspace:WaitForChild("NPCS"):WaitForChild("Sell Stands")
  888.                     local closestStand = nil
  889.                     local closestDist = math.huge
  890.                     local closestPart = nil
  891.                    
  892.                     -- Find the closest sell stand
  893.                     for _, stand in ipairs(standsFolder:GetChildren()) do
  894.                         local targetPart
  895.                         if stand:IsA("Model") then
  896.                             targetPart = stand.PrimaryPart or stand:FindFirstChildWhichIsA("BasePart")
  897.                         elseif stand:IsA("BasePart") then
  898.                             targetPart = stand
  899.                         end
  900.                        
  901.                         if targetPart then
  902.                             local dist = (hrp.Position - targetPart.Position).Magnitude
  903.                             if dist < closestDist then
  904.                                 closestStand = stand
  905.                                 closestDist = dist
  906.                                 closestPart = targetPart
  907.                             end
  908.                         end
  909.                     end
  910.                    
  911.                     if not closestPart then return end
  912.                    
  913.                     -- Original position for teleporting back
  914.                     local originalCFrame = hrp.CFrame
  915.                     local originalState = humanoid:GetState()
  916.                    
  917.                     -- Check if already near a sell stand (within 15 studs)
  918.                     local isNearStand = closestDist <= 15
  919.                    
  920.                     -- Only teleport if not already near
  921.                     if not isNearStand then
  922.                         -- Store the current state
  923.                         local currentPlatformStand = humanoid.PlatformStand
  924.                        
  925.                         -- Teleport to the front of the stand with proper orientation
  926.                         local standCF = closestPart.CFrame
  927.                         local lookAt = (standCF.Position - Vector3.new(standCF.Position.X, hrp.Position.Y, standCF.Position.Z)).Unit
  928.                         local targetCF = CFrame.new(standCF.Position + Vector3.new(-3, 0, 5))
  929.                        
  930.                         -- Teleport
  931.                         hrp.CFrame = targetCF
  932.                        
  933.                         -- Reset humanoid state to fix animation
  934.                         humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
  935.                         task.wait(0.1)
  936.                         humanoid:ChangeState(Enum.HumanoidStateType.Running)
  937.                         humanoid.PlatformStand = false
  938.                        
  939.                         task.wait(0.5)  -- Wait for teleport and animation reset
  940.                     end
  941.                    
  942.                     -- Try submitting all plants first if needed
  943.                     task.spawn(function()
  944.                         pcall(function()
  945.                             game:GetService("ReplicatedStorage").GameEvents.NightQuestRemoteEvent:FireServer("SubmitAllPlants")
  946.                         end)
  947.                     end)
  948.                    
  949.                     task.wait(0.5)
  950.                    
  951.                     -- Sell
  952.                     sellRemote:FireServer()
  953.                     task.wait(0.5)
  954.                    
  955.                     -- Return to original position only if we teleported
  956.                     if not isNearStand then
  957.                         -- Teleport back
  958.                         hrp.CFrame = originalCFrame
  959.                        
  960.                         -- Reset state again
  961.                         humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
  962.                         task.wait(0.1)
  963.                         humanoid:ChangeState(Enum.HumanoidStateType.Running)
  964.                         humanoid.PlatformStand = false
  965.                     end
  966.                 end)
  967.             end
  968.         end)
  969.        
  970.         autoSellThread = spawn(function()
  971.             while isAutoSellEnabled do
  972.                 task.wait(1)
  973.             end
  974.            
  975.             -- Clean up notification connection when disabled
  976.             if notificationConnection then
  977.                 notificationConnection:Disconnect()
  978.             end
  979.            
  980.             autoSellThread = nil
  981.         end)
  982.     else
  983.         autoSellThread = nil
  984.     end
  985.  
  986.     return isAutoSellEnabled
  987. end]]
  988.  
  989. function Auto_Sell_Multiple()
  990.     isAutoSellOneByOneEnabled = not isAutoSellOneByOneEnabled
  991.  
  992.     if isAutoSellOneByOneEnabled then
  993.         autoSellOneByOneThread = spawn(function()
  994.             while isAutoSellOneByOneEnabled do
  995.                 pcall(function()
  996.                     -- Get player data to check for items
  997.                     local DataService = require(ReplicatedStorage.Modules.DataService)
  998.                     local playerData = DataService:GetData()
  999.  
  1000.                     if not playerData or not playerData.InventoryData then return end
  1001.  
  1002.                     -- Find items we can sell (not seeds, not favorites)
  1003.                     local itemsToSell = {}
  1004.                     for uuid, itemData in pairs(playerData.InventoryData) do
  1005.                         if itemData.ItemType == "Holdable" and itemData.ItemData then
  1006.                             -- Skip favorited items
  1007.                             if not itemData.ItemData.IsFavorite then
  1008.                                 -- Check if item has a protected variant
  1009.                                 local shouldSkip = false
  1010.                                
  1011.                                 -- Check for variants
  1012.                                 if itemData.ItemData.Variant and DoNotSell_Variants[itemData.ItemData.Variant] == true then
  1013.                                     shouldSkip = true
  1014.                                 end
  1015.                                
  1016.                                 -- Check for mutations
  1017.                                 if not shouldSkip and itemData.ItemData.MutationString then
  1018.                                     for mutation, excluded in pairs(DoNotSell_Mutations) do
  1019.                                         if excluded and itemData.ItemData.MutationString:find(mutation) then
  1020.                                             shouldSkip = true
  1021.                                             break
  1022.                                         end
  1023.                                     end
  1024.                                 end
  1025.                                
  1026.                                 -- Only proceed if item is not to be skipped
  1027.                                 if not shouldSkip then
  1028.                                     local tool = nil
  1029.                                     for _, t in pairs(player.Backpack:GetChildren()) do
  1030.                                         if t:IsA("Tool") and t:GetAttribute("ITEM_UUID") == uuid then
  1031.                                             tool = t
  1032.                                             break
  1033.                                         end
  1034.                                     end
  1035.                                     if not tool and player.Character then
  1036.                                         for _, t in pairs(player.Character:GetChildren()) do
  1037.                                             if t:IsA("Tool") and t:GetAttribute("ITEM_UUID") == uuid then
  1038.                                                 tool = t
  1039.                                                 break
  1040.                                             end
  1041.                                         end
  1042.                                     end
  1043.                                    
  1044.                                     -- If we found the tool, check its price
  1045.                                     if tool then
  1046.                                         -- Calculate the item's value
  1047.                                         local itemValue = 0
  1048.                                        
  1049.                                         if tool:GetAttribute("ItemType") == "Pet" then
  1050.                                             itemValue = CalculatePetValue(tool)
  1051.                                         else
  1052.                                             itemValue = CalculatePlantValue(tool)
  1053.                                         end
  1054.                                        
  1055.                                         -- Only sell if value is below Keep_Value
  1056.                                         if itemValue < Keep_Value then
  1057.                                             table.insert(itemsToSell, tool)
  1058.                                         end
  1059.                                     end
  1060.                                 end
  1061.                             end
  1062.                         end
  1063.                     end
  1064.  
  1065.                     -- Only teleport and sell if we found items to sell
  1066.                     if #itemsToSell > 10 then
  1067.                         -- Ensure character and HRP exist
  1068.                         local char = player.Character or player.CharacterAdded:Wait()
  1069.                         local hrp = char:FindFirstChild("HumanoidRootPart")
  1070.                         local humanoid = char:FindFirstChild("Humanoid")
  1071.                         if not hrp or not humanoid then return end
  1072.                        
  1073.                         -- Find a sell stand
  1074.                         local standsFolder = workspace:WaitForChild("NPCS"):WaitForChild("Sell Stands")
  1075.                         local closestStand = nil
  1076.                         local closestDist = math.huge
  1077.                         local closestPart = nil
  1078.                        
  1079.                         -- Find the closest sell stand
  1080.                         for _, stand in ipairs(standsFolder:GetChildren()) do
  1081.                             local targetPart
  1082.                             if stand:IsA("Model") then
  1083.                                 targetPart = stand.PrimaryPart or stand:FindFirstChildWhichIsA("BasePart")
  1084.                             elseif stand:IsA("BasePart") then
  1085.                                 targetPart = stand
  1086.                             end
  1087.                            
  1088.                             if targetPart then
  1089.                                 local dist = (hrp.Position - targetPart.Position).Magnitude
  1090.                                 if dist < closestDist then
  1091.                                     closestStand = stand
  1092.                                     closestDist = dist
  1093.                                     closestPart = targetPart
  1094.                                 end
  1095.                             end
  1096.                         end
  1097.                        
  1098.                         if not closestPart then return end
  1099.                        
  1100.                         -- Original position for teleporting back
  1101.                         local originalCFrame = hrp.CFrame
  1102.                         local originalState = humanoid:GetState()
  1103.                        
  1104.                         -- Check if already near a sell stand (within 5 studs)
  1105.                         local isNearStand = closestDist <= 5
  1106.                        
  1107.                         -- Only teleport if not already near
  1108.                         if not isNearStand then
  1109.                             -- Store the current state
  1110.                             local currentPlatformStand = humanoid.PlatformStand
  1111.                            
  1112.                             -- Teleport to the front of the stand with proper orientation
  1113.                             local standCF = closestPart.CFrame
  1114.                             local targetCF = CFrame.new(standCF.Position + Vector3.new(-3, 0, 5))
  1115.                            
  1116.                             -- Teleport
  1117.                             hrp.CFrame = targetCF
  1118.                            
  1119.                             -- Reset humanoid state to fix animation
  1120.                             humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
  1121.                             task.wait(0.1)
  1122.                             humanoid:ChangeState(Enum.HumanoidStateType.Running)
  1123.                             humanoid.PlatformStand = false
  1124.                            
  1125.                             task.wait(0.5)  -- Wait for teleport and animation reset
  1126.                         end
  1127.                        
  1128.                         -- Sell all items found, one by one
  1129.                         for _, tool in ipairs(itemsToSell) do
  1130.                             if tool.Parent ~= player.Character then
  1131.                                 tool.Parent = player.Character
  1132.                                 task.wait(0.01)
  1133.                             end
  1134.                             sell_One_Remote:FireServer()
  1135.                             task.wait(0.1) -- Small delay between sells to avoid flooding
  1136.                         end
  1137.                        
  1138.                         -- Return to original position only if we teleported
  1139.                         if not isNearStand then
  1140.                             -- Teleport back
  1141.                             hrp.CFrame = originalCFrame
  1142.                            
  1143.                             -- Reset state again
  1144.                             humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
  1145.                             task.wait(0.1)
  1146.                             humanoid:ChangeState(Enum.HumanoidStateType.Running)
  1147.                             humanoid.PlatformStand = false
  1148.                         end
  1149.                     end
  1150.                 end)
  1151.                 task.wait(1) -- Wait before next check
  1152.             end
  1153.             autoSellOneByOneThread = nil
  1154.         end)
  1155.     else
  1156.         if autoSellOneByOneThread then
  1157.             task.cancel(autoSellOneByOneThread)
  1158.         end
  1159.         autoSellOneByOneThread = nil
  1160.     end
  1161.  
  1162.     return isAutoSellOneByOneEnabled
  1163. end
  1164.  
  1165. -- AUTO-FAVORITE FUNCTION
  1166. function Auto_Favorite()
  1167.     isAutoFavoriteEnabled = not isAutoFavoriteEnabled
  1168.  
  1169.     if isAutoFavoriteEnabled then
  1170.         autoFavoriteThread = spawn(function()
  1171.             while isAutoFavoriteEnabled do
  1172.                 pcall(function()
  1173.                     -- Get inventory data
  1174.                     local DataService = require(ReplicatedStorage.Modules.DataService)
  1175.                     local playerData = DataService:GetData()
  1176.                    
  1177.                     if playerData and playerData.InventoryData then
  1178.                         for uuid, record in pairs(playerData.InventoryData) do
  1179.                             -- Only check Holdable items
  1180.                             if record.ItemType == "Holdable" and record.ItemData then
  1181.                                 -- Skip already favorited items
  1182.                                 if record.ItemData.IsFavorite ~= true then
  1183.                                     -- Find the tool object in player's inventory
  1184.                                     local tool = nil
  1185.                                     local backpack = player.Backpack
  1186.                                     for _, t in pairs(backpack:GetChildren()) do
  1187.                                         if t:IsA("Tool") and t:GetAttribute("ITEM_UUID") == uuid then
  1188.                                             tool = t
  1189.                                             break
  1190.                                         end
  1191.                                     end
  1192.                                    
  1193.                                     if tool then
  1194.                                         local shouldFavorite = false
  1195.                                         local reason = ""
  1196.                                        
  1197.                                         -- Priority 1: Check for mutations (highest priority)
  1198.                                         local hasMutation = false
  1199.                                         if record.ItemData.MutationString then
  1200.                                             for mutation, shouldFavoriteMutation in pairs(Favorite_Mutations) do
  1201.                                                 if shouldFavoriteMutation and record.ItemData.MutationString:find(mutation) then
  1202.                                                     hasMutation = true
  1203.                                                     shouldFavorite = true
  1204.                                                     reason = "mutation"
  1205.                                                     break
  1206.                                                 end
  1207.                                             end
  1208.                                         end
  1209.                                        
  1210.                                         -- Priority 2: Check item value if not already favorited by mutation
  1211.                                         if not shouldFavorite then
  1212.                                             local itemValue = 0
  1213.                                            
  1214.                                             if tool:GetAttribute("ItemType") == "Pet" then
  1215.                                                 itemValue = CalculatePetValue(tool)
  1216.                                             else
  1217.                                                 itemValue = CalculatePlantValue(tool)
  1218.                                             end
  1219.                                            
  1220.                                             if itemValue >= Keep_Value then
  1221.                                                 shouldFavorite = true
  1222.                                                 reason = "high value"
  1223.                                             end
  1224.                                         end
  1225.                                        
  1226.                                         -- Priority 3: Check for special variant (lowest priority)
  1227.                                         if not shouldFavorite then
  1228.                                             local hasSpecialVariant = record.ItemData.Variant ~= nil and
  1229.                                                                 Favorite_Variants[record.ItemData.Variant] == true
  1230.                                            
  1231.                                             if hasSpecialVariant then
  1232.                                                 shouldFavorite = true
  1233.                                                 reason = "variant"
  1234.                                             end
  1235.                                         end
  1236.                                        
  1237.                                         -- Favorite the item if any condition was met
  1238.                                         if shouldFavorite then
  1239.                                             -- Get the Favorite_Item remote
  1240.                                             local favoriteRemote = ReplicatedStorage:WaitForChild("GameEvents")
  1241.                                                                 :WaitForChild("Favorite_Item")
  1242.                                            
  1243.                                             favoriteRemote:FireServer(tool)
  1244.                                             task.wait(0.1) -- Wait to avoid flooding the server
  1245.                                         end
  1246.                                     end
  1247.                                 end
  1248.                             end
  1249.                         end
  1250.                     end
  1251.                 end)
  1252.                 task.wait(0.1) -- Check frequently
  1253.             end
  1254.             autoFavoriteThread = nil
  1255.         end)
  1256.     else
  1257.         autoFavoriteThread = nil
  1258.     end
  1259.  
  1260.     return isAutoFavoriteEnabled
  1261. end
  1262.  
  1263. -- AUTO-BUY EGG FUNCTION
  1264. function Auto_BuyEgg()
  1265.     isAutoBuyEggEnabled = not isAutoBuyEggEnabled
  1266.    
  1267.     if isAutoBuyEggEnabled then
  1268.         autoBuyEggThread = spawn(function()
  1269.             while isAutoBuyEggEnabled do
  1270.                 pcall(function()
  1271.                     local DataService = require(ReplicatedStorage.Modules.DataService)
  1272.                     local playerData = DataService:GetData()
  1273.                    
  1274.                     if playerData and playerData.PetEggStock and playerData.PetEggStock.Stocks then
  1275.                        
  1276.                         for eggIndex, eggData in pairs(playerData.PetEggStock.Stocks) do
  1277.                             -- ALERT: Legendary or Bug Egg in stock
  1278.                             if (eggData.EggName == "Bee Egg" or eggData.EggName == "Bug Egg" or
  1279.                                 eggData.EggName == "Night Egg") and eggData.Stock > 0 then
  1280.                                 -- Send webhook notification
  1281.                                 pcall(function()
  1282.                                     request({
  1283.                                         Url     = webhookUrl,
  1284.                                         Method  = "POST",
  1285.                                         Headers = { ["Content-Type"] = "application/json" },
  1286.                                         Body    = HttpService:JSONEncode({
  1287.                                             embeds = {{
  1288.                                                 title = "Grow A Garden Alert",
  1289.                                                 color = 16753920,
  1290.                                                 fields = {
  1291.                                                     { name = "Egg",   value = eggData.EggName   },
  1292.                                                     { name = "Stock", value = tostring(eggData.Stock) }
  1293.                                                 }
  1294.                                             }}
  1295.                                         })
  1296.                                     })
  1297.                                 end)
  1298.  
  1299.                             end
  1300.  
  1301.                             -- Check if this egg is on our buy list and in stock
  1302.                             if Buy_PetEggs[eggData.EggName] and eggData.Stock > 0 then
  1303.  
  1304.                                 -- Try to buy all available stock
  1305.                                 local stockAmount = eggData.Stock
  1306.                                 for i = 1, stockAmount do
  1307.                                     -- Make purchase request
  1308.                                     ReplicatedStorage.GameEvents.BuyPetEgg:FireServer(eggIndex)
  1309.                                    
  1310.                                     -- Wait between purchases
  1311.                                     task.wait(0.5)
  1312.                                    
  1313.                                     -- Check if purchase was successful by checking updated stock
  1314.                                     local updatedData = DataService:GetData()
  1315.                                     if updatedData and updatedData.PetEggStock and
  1316.                                        updatedData.PetEggStock.Stocks[eggIndex] then
  1317.                                         local newStock = updatedData.PetEggStock.Stocks[eggIndex].Stock
  1318.                                         if newStock < stockAmount then
  1319.                                             stockAmount = newStock  -- Update remaining stock
  1320.                                             if stockAmount == 0 then break end
  1321.                                         else
  1322.                                             task.wait(1)
  1323.                                             break
  1324.                                         end
  1325.                                     end
  1326.                                 end
  1327.                             end
  1328.                         end
  1329.                     end
  1330.                 end)
  1331.                
  1332.                 -- Check for eggs every 5 seconds (more frequent than before)
  1333.                 task.wait(5)
  1334.             end
  1335.             autoBuyEggThread = nil
  1336.         end)
  1337.     else
  1338.         if autoBuyEggThread then
  1339.             task.cancel(autoBuyEggThread)
  1340.             autoBuyEggThread = nil
  1341.         end
  1342.     end
  1343.    
  1344.     return isAutoBuyEggEnabled
  1345. end
  1346.  
  1347. -- AUTO-BUY GEAR FUNCTION
  1348. function Auto_BuyGear()
  1349.     isAutoBuyGearEnabled = not isAutoBuyGearEnabled
  1350.    
  1351.     if isAutoBuyGearEnabled then
  1352.         autoBuyGearThread = spawn(function()
  1353.             while isAutoBuyGearEnabled do
  1354.                 pcall(function()
  1355.                     local DataService = require(ReplicatedStorage.Modules.DataService)
  1356.                     local playerData = DataService:GetData()
  1357.                    
  1358.                     if playerData and playerData.GearStock and playerData.GearStock.Stocks then
  1359.                        
  1360.                         -- Track which items we've purchased in this cycle
  1361.                         local purchasedItems = {}
  1362.                        
  1363.                         for itemName, stockData in pairs(playerData.GearStock.Stocks) do
  1364.                             -- ALERT: Master Sprinkler in stock
  1365.                             if itemName == "Master Sprinkler" and stockData.Stock > 0 then
  1366.                                 -- Send webhook notification
  1367.                                 pcall(function()
  1368.                                     request({
  1369.                                         Url     = webhookUrl,
  1370.                                         Method  = "POST",
  1371.                                         Headers = { ["Content-Type"] = "application/json" },
  1372.                                         Body    = HttpService:JSONEncode({
  1373.                                             embeds = {{
  1374.                                                 title = "Grow A Garden Alert",
  1375.                                                 color = 65280,
  1376.                                                 fields = {
  1377.                                                     { name = "Item",  value = itemName   },
  1378.                                                     { name = "Stock", value = tostring(stockData.Stock) }
  1379.                                                 }
  1380.                                             }}
  1381.                                         })
  1382.                                     })
  1383.                                 end)
  1384.  
  1385.                             end
  1386.  
  1387.                             -- Check if this gear is on our buy list and in stock
  1388.                             if Buy_GearShop[itemName] == true and stockData.Stock > 0 then
  1389.                                
  1390.                                 -- Try to buy all available stock
  1391.                                 local stockAmount = stockData.Stock
  1392.                                 for i = 1, stockAmount do
  1393.                                     -- Make purchase request
  1394.                                     ReplicatedStorage.GameEvents.BuyGearStock:FireServer(itemName)
  1395.                                    
  1396.                                     -- Wait between purchases
  1397.                                     task.wait(0.5)
  1398.                                    
  1399.                                     -- Check if purchase was successful by checking updated stock
  1400.                                     local updatedData = DataService:GetData()
  1401.                                     if updatedData and updatedData.GearStock and
  1402.                                        updatedData.GearStock.Stocks[itemName] then
  1403.                                         local newStock = updatedData.GearStock.Stocks[itemName].Stock
  1404.                                         if newStock < stockAmount then
  1405.                                             table.insert(purchasedItems, itemName)
  1406.                                             stockAmount = newStock  -- Update remaining stock
  1407.                                             if stockAmount == 0 then break end
  1408.                                         else
  1409.                                             task.wait(1)
  1410.                                             break
  1411.                                         end
  1412.                                     end
  1413.                                 end
  1414.                             end
  1415.                         end
  1416.                        
  1417.                         -- Submit plants quest only once after we've made purchases
  1418.                         if #purchasedItems > 0 then
  1419.                             task.wait(1)
  1420.                             pcall(function()
  1421.                                 game:GetService("ReplicatedStorage").GameEvents.NightQuestRemoteEvent:FireServer("SubmitAllPlants")
  1422.                             end)
  1423.                         end
  1424.                     end
  1425.                 end)
  1426.                
  1427.                 -- Check for gear every 5 seconds
  1428.                 task.wait(5)
  1429.             end
  1430.             autoBuyGearThread = nil
  1431.         end)
  1432.     else
  1433.         if autoBuyGearThread then
  1434.             task.cancel(autoBuyGearThread)
  1435.             autoBuyGearThread = nil
  1436.         end
  1437.     end
  1438.    
  1439.     return isAutoBuyGearEnabled
  1440. end
  1441.  
  1442. -- AUTO-BUY EVENT SHOP FUNCTION
  1443. function Auto_BuyEvent()
  1444.     isAutoBuyEventEnabled = not isAutoBuyEventEnabled
  1445.    
  1446.     if isAutoBuyEventEnabled then
  1447.         autoBuyEventThread = spawn(function()
  1448.             while isAutoBuyEventEnabled do
  1449.                 pcall(function()
  1450.                     -- Check if it's blood moon
  1451.                     local isBloodMoon = workspace:GetAttribute("BloodMoonEvent") or false
  1452.                    
  1453.                     -- Only run during blood moon
  1454.                     if isBloodMoon then
  1455.                         -- Get Event Shop data
  1456.                         local DataService = require(ReplicatedStorage.Modules.DataService)
  1457.                         local playerData = DataService:GetData()
  1458.                        
  1459.                         if playerData and playerData.EventShopStock and playerData.EventShopStock.Stocks then
  1460.                            
  1461.                             -- Check current Blood Kiwi count in inventory
  1462.                             local bloodKiwiCount = 0
  1463.                             if playerData.InventoryData then
  1464.                                 for _, itemData in pairs(playerData.InventoryData) do
  1465.                                     if itemData.ItemType == "Holdable" and itemData.ItemData and
  1466.                                     itemData.ItemData.ItemName == "Blood Kiwi" then
  1467.                                         bloodKiwiCount = bloodKiwiCount + 1
  1468.                                     end
  1469.                                 end
  1470.                             end
  1471.  
  1472.                             for itemName, stockData in pairs(playerData.EventShopStock.Stocks) do
  1473.                                 -- Skip Blood Kiwi if we already have 8 or more
  1474.                                 if itemName == "Blood Kiwi" and bloodKiwiCount >= 8 then
  1475.                                     continue
  1476.                                 end
  1477.                                
  1478.                                 -- For ANY item in stock, if we don't have it in our Buy_EventShop table yet, add it
  1479.                                 if Buy_EventShop[itemName] == nil then
  1480.                                     Buy_EventShop[itemName] = true
  1481.                                 end
  1482.                                
  1483.                                 -- Special alert for Divine rarity items or any item with Stock > 0
  1484.                                 if stockData.Stock > 0 then
  1485.                                     -- Send more detailed webhook for rarer items
  1486.                                     local eventItem = require(ReplicatedStorage.Data:WaitForChild("EventShopData"))[itemName]
  1487.                                     local rarity = eventItem and eventItem.SeedRarity or "Unknown"
  1488.                                    
  1489.                                     if rarity == "Divine" or rarity == "Legendary" or rarity == "Mythical" then
  1490.                                         pcall(function()
  1491.                                             request({
  1492.                                                 Url     = webhookUrl,
  1493.                                                 Method  = "POST",
  1494.                                                 Headers = { ["Content-Type"] = "application/json" },
  1495.                                                 Body    = HttpService:JSONEncode({
  1496.                                                     embeds = {{
  1497.                                                         title = "Grow A Garden Alert: " .. rarity .. " Item",
  1498.                                                         color = (rarity == "Divine") and 16711680 or 16776960,
  1499.                                                         fields = {
  1500.                                                             { name = "Event Item", value = itemName },
  1501.                                                             { name = "Rarity", value = rarity },
  1502.                                                             { name = "Stock", value = tostring(stockData.Stock) }
  1503.                                                         }
  1504.                                                     }}
  1505.                                                 })
  1506.                                             })
  1507.                                         end)
  1508.                                     end
  1509.                                 end
  1510.  
  1511.                                 -- Attempt to buy if in our list and in stock
  1512.                                 if Buy_EventShop[itemName] == true and stockData.Stock > 0 then
  1513.                                     -- Try to buy all available stock
  1514.                                     local stockAmount = stockData.Stock
  1515.                                     for i = 1, stockAmount do
  1516.                                         -- Make purchase request
  1517.                                         ReplicatedStorage.GameEvents.BuyEventShopStock:FireServer(itemName)
  1518.                                         ReplicatedStorage.GameEvents.BuyEventShopStock:FireServer("Candy Blossom")
  1519.                                         ReplicatedStorage.GameEvents.BuyEventShopStock:FireServer("Chocolate Sprinkler")
  1520.                                        
  1521.                                         -- Wait between purchases
  1522.                                         task.wait(0.5)
  1523.                                        
  1524.                                         -- Check if purchase was successful
  1525.                                         local updatedData = DataService:GetData()
  1526.                                         if updatedData and updatedData.EventShopStock and
  1527.                                            updatedData.EventShopStock.Stocks[itemName] then
  1528.                                             local newStock = updatedData.EventShopStock.Stocks[itemName].Stock
  1529.                                             if newStock < stockAmount then
  1530.                                                 stockAmount = newStock  -- Update remaining stock
  1531.                                                 if stockAmount == 0 then break end
  1532.                                             else
  1533.                                                 task.wait(1)
  1534.                                                 break
  1535.                                             end
  1536.                                         end
  1537.                                     end
  1538.                                 end
  1539.                             end
  1540.                         end
  1541.                     end
  1542.                 end)
  1543.                
  1544.                 -- Check for event shop items more frequently (once per second)
  1545.                 task.wait(1)
  1546.             end
  1547.             autoBuyEventThread = nil
  1548.         end)
  1549.     else
  1550.         if autoBuyEventThread then
  1551.             task.cancel(autoBuyEventThread)
  1552.             autoBuyEventThread = nil
  1553.         end
  1554.     end
  1555.    
  1556.     return isAutoBuyEventEnabled
  1557. end
  1558.  
  1559.  
  1560. -- AUTO-BUY TWILIGHT SHOP FUNCTION
  1561. function Auto_BuyTwilight()
  1562.     isAutoBuyTwilightEnabled = not isAutoBuyTwilightEnabled
  1563.    
  1564.     if isAutoBuyTwilightEnabled then
  1565.         autoBuyTwilightThread = spawn(function()
  1566.             while isAutoBuyTwilightEnabled do
  1567.                 pcall(function()
  1568.                     -- Check if it's regular night (not blood moon)
  1569.                     local isNight = workspace:GetAttribute("NightEvent") or false
  1570.                     local isBloodMoon = workspace:GetAttribute("BloodMoonEvent") or false
  1571.                    
  1572.                     -- Only run during regular night (when isNight is true and isBloodMoon is false)
  1573.                     if isNight and not isBloodMoon then
  1574.                         -- Get NightEventShop data
  1575.                         local DataService = require(ReplicatedStorage.Modules.DataService)
  1576.                         local playerData = DataService:GetData()
  1577.                        
  1578.                         if playerData and playerData.NightEventShopStock and playerData.NightEventShopStock.Stocks then
  1579.                             for itemName, stockData in pairs(playerData.NightEventShopStock.Stocks) do
  1580.                                 -- Special alert for rare items in stock
  1581.                                 if stockData.Stock > 0 then
  1582.                                     -- Get item data from ReplicatedStorage
  1583.                                     local NightEventShopData = require(ReplicatedStorage.Data:WaitForChild("NightEventShopData"))
  1584.                                     local itemInfo = NightEventShopData[itemName]
  1585.                                    
  1586.                                     if itemInfo then
  1587.                                         local rarity = itemInfo.SeedRarity or "Unknown"
  1588.                                         -- Send webhook for rare items
  1589.                                         if rarity == "Divine" or rarity == "Mythical" or rarity == "Legendary" then
  1590.                                             pcall(function()
  1591.                                                 request({
  1592.                                                     Url     = webhookUrl,
  1593.                                                     Method  = "POST",
  1594.                                                     Headers = { ["Content-Type"] = "application/json" },
  1595.                                                     Body    = HttpService:JSONEncode({
  1596.                                                         embeds = {{
  1597.                                                             title = "Grow A Garden Alert: Twilight Shop",
  1598.                                                             color = (rarity == "Divine") and 16711680 or 16776960,
  1599.                                                             fields = {
  1600.                                                                 { name = "Item", value = itemName },
  1601.                                                                 { name = "Rarity", value = rarity },
  1602.                                                                 { name = "Stock", value = tostring(stockData.Stock) }
  1603.                                                             }
  1604.                                                         }}
  1605.                                                     })
  1606.                                                 })
  1607.                                             end)
  1608.                                         end
  1609.                                     end
  1610.                                 end
  1611.                                
  1612.                                 -- Attempt to buy if in our list and in stock
  1613.                                 if Buy_TwilightShop[itemName] == true and stockData.Stock > 0 then
  1614.                                     -- Try to buy all available stock
  1615.                                     local stockAmount = stockData.Stock
  1616.                                     for i = 1, stockAmount do
  1617.                                         -- Make purchase request
  1618.                                         ReplicatedStorage.GameEvents.BuyNightEventShopStock:FireServer(itemName)
  1619.                                        
  1620.                                         -- Wait between purchases
  1621.                                         task.wait(0.5)
  1622.                                        
  1623.                                         -- Check if purchase was successful
  1624.                                         local updatedData = DataService:GetData()
  1625.                                         if updatedData and updatedData.NightEventShopStock and
  1626.                                            updatedData.NightEventShopStock.Stocks[itemName] then
  1627.                                             local newStock = updatedData.NightEventShopStock.Stocks[itemName].Stock
  1628.                                             if newStock < stockAmount then
  1629.                                                 stockAmount = newStock  -- Update remaining stock
  1630.                                                 if stockAmount == 0 then break end
  1631.                                             else
  1632.                                                 task.wait(1)
  1633.                                                 break
  1634.                                             end
  1635.                                         end
  1636.                                     end
  1637.                                 end
  1638.                             end
  1639.                         end
  1640.                     end
  1641.                 end)
  1642.                
  1643.                 -- Check for twilight shop items every second
  1644.                 task.wait(1)
  1645.             end
  1646.             autoBuyTwilightThread = nil
  1647.         end)
  1648.     else
  1649.         if autoBuyTwilightThread then
  1650.             task.cancel(autoBuyTwilightThread)
  1651.             autoBuyTwilightThread = nil
  1652.         end
  1653.     end
  1654.    
  1655.     return isAutoBuyTwilightEnabled
  1656. end
  1657.  
  1658.  
  1659. -- AUTO-BUY SEED FUNCTION
  1660. function Auto_BuySeed()
  1661.     isAutoBuySeedEnabled = not isAutoBuySeedEnabled
  1662.    
  1663.     if isAutoBuySeedEnabled then
  1664.         autoBuySeedThread = spawn(function()
  1665.             while isAutoBuySeedEnabled do
  1666.                 pcall(function()
  1667.                     -- Get seed data and stock info
  1668.                     local DataService = require(ReplicatedStorage.Modules.DataService)
  1669.                     local SeedData = require(ReplicatedStorage.Data.SeedData)
  1670.                     local playerData = DataService:GetData()
  1671.                    
  1672.                     if playerData and playerData.SeedStock and playerData.SeedStock.Stocks then
  1673.                         -- Check each seed in our buy list
  1674.                         for seedName, shouldBuy in pairs(Buy_Seeds) do
  1675.                             if shouldBuy then
  1676.                                 -- Verify the seed exists in SeedData and is displayed in shop
  1677.                                 local seedInfo = SeedData[seedName]
  1678.                                 if seedInfo and seedInfo.DisplayInShop then
  1679.                                     -- Keep buying until stock depleted
  1680.                                     while isAutoBuySeedEnabled do
  1681.                                         -- Get fresh data to check current stock
  1682.                                         playerData = DataService:GetData()
  1683.                                         local stockInfo = playerData.SeedStock.Stocks[seedName]
  1684.                                        
  1685.                                         if stockInfo and stockInfo.Stock > 0 then
  1686.                                             -- Buy the seed
  1687.                                             ReplicatedStorage.GameEvents.BuySeedStock:FireServer(seedName)
  1688.  
  1689.                                             -- Short wait to allow server to process
  1690.                                             task.wait(0.1)
  1691.                                         else
  1692.                                             -- No more stock for this seed, move to next
  1693.                                             break
  1694.                                         end
  1695.                                     end
  1696.                                 end
  1697.                             end
  1698.                         end
  1699.                     end
  1700.                 end)
  1701.                
  1702.                 -- Check every 5 seconds for restocked seeds
  1703.                 task.wait(5)
  1704.             end
  1705.             autoBuySeedThread = nil
  1706.         end)
  1707.     else
  1708.         autoBuySeedThread = nil
  1709.     end
  1710.    
  1711.     return isAutoBuySeedEnabled
  1712. end
  1713.  
  1714. function Auto_Plant()
  1715.     -- First check if we already know there's a special plant
  1716.     if hasSpecialPlant then
  1717.         return false
  1718.     end
  1719.    
  1720.     -- Check again for special plants
  1721.     if CheckForSpecialPlants() then
  1722.         return false
  1723.     end
  1724.    
  1725.     isAutoPlantEnabled = not isAutoPlantEnabled
  1726.    
  1727.     if isAutoPlantEnabled then
  1728.         -- Immediately check if we're already at max capacity before starting
  1729.         local playerPlot = GetFarm(player)
  1730.         local currentPlantCount = 0
  1731.        
  1732.         if playerPlot and playerPlot:FindFirstChild("Important") and
  1733.            playerPlot.Important:FindFirstChild("Plants_Physical") then
  1734.             currentPlantCount = #playerPlot.Important.Plants_Physical:GetChildren()
  1735.         end
  1736.        
  1737.         -- Don't start if we're at capacity
  1738.         if currentPlantCount >= 50 then
  1739.             isAutoPlantEnabled = false
  1740.             hasSpecialPlant = true
  1741.             return false
  1742.         end
  1743.        
  1744.         autoPlantThread = spawn(function()
  1745.             while isAutoPlantEnabled do
  1746.                 pcall(function()
  1747.                     local DataService = require(ReplicatedStorage.Modules.DataService)
  1748.                     local playerData = DataService:GetData()
  1749.                    
  1750.                     if playerData and playerData.InventoryData then
  1751.                         -- Find the player's plot
  1752.                         local playerPlot = GetFarm(player)
  1753.                         if not playerPlot then return end
  1754.                        
  1755.                         -- Check for special plants
  1756.                         if CheckForSpecialPlants() then
  1757.                             isAutoPlantEnabled = false
  1758.                             if autoPlantThread then
  1759.                                 task.cancel(autoPlantThread)
  1760.                                 autoPlantThread = nil
  1761.                             end
  1762.                             return
  1763.                         end
  1764.                        
  1765.                         -- Check how many plants we already have
  1766.                         if playerPlot:FindFirstChild("Important") and
  1767.                            playerPlot.Important:FindFirstChild("Plants_Physical") then
  1768.                             currentPlantCount = #playerPlot.Important.Plants_Physical:GetChildren()
  1769.                         end
  1770.                        
  1771.                         -- Set a safety margin - stop at 50 to prevent accidental overflow
  1772.                         if currentPlantCount >= 50 then
  1773.                             -- Turn off auto-plant functionality
  1774.                             isAutoPlantEnabled = false
  1775.                             if autoPlantThread then
  1776.                                 task.cancel(autoPlantThread)
  1777.                                 autoPlantThread = nil
  1778.                             end
  1779.                             return
  1780.                         end
  1781.                        
  1782.                         -- Find all Can_Plant parts
  1783.                         local plantSpots = {}
  1784.                         local allCanPlantParts = {}
  1785.                         for _, obj in pairs(playerPlot:GetDescendants()) do
  1786.                             if obj.Name == "Can_Plant" and obj:IsA("BasePart") then
  1787.                                 table.insert(allCanPlantParts, obj)
  1788.                             end
  1789.                         end
  1790.                        
  1791.                         -- Only use the second Can_Plant or the last one if there aren't at least 2
  1792.                         if #allCanPlantParts >= 2 then
  1793.                             plantSpots = {allCanPlantParts[2]} -- Use only the second Can_Plant
  1794.                         else
  1795.                             plantSpots = {allCanPlantParts[#allCanPlantParts]} -- Use the last one if not enough
  1796.                         end
  1797.                                                
  1798.                         if #plantSpots == 0 then return end
  1799.                        
  1800.                         -- Find seeds in inventory
  1801.                         local seedsToPlant = {}
  1802.                         for uuid, itemData in pairs(playerData.InventoryData) do
  1803.                             if itemData.ItemType == "Seed" and itemData.ItemData then
  1804.                                 local seedName = itemData.ItemData.ItemName
  1805.                                 local quantity = itemData.ItemData.Quantity or 0
  1806.                                
  1807.                                 if Plant_Seeds[seedName] and quantity > 0 then
  1808.                                     table.insert(seedsToPlant, {
  1809.                                         uuid = uuid,
  1810.                                         name = seedName,
  1811.                                         quantity = quantity
  1812.                                     })
  1813.                                 end
  1814.                             end
  1815.                         end
  1816.                        
  1817.                         -- If we have seeds, try to plant them
  1818.                         if #seedsToPlant > 0 then
  1819.                             for _, seedInfo in pairs(seedsToPlant) do
  1820.                                 if seedInfo.quantity > 0 then
  1821.                                     -- Check plant count again before each seed type
  1822.                                     if playerPlot:FindFirstChild("Important") and
  1823.                                        playerPlot.Important:FindFirstChild("Plants_Physical") then
  1824.                                        
  1825.                                         -- Check for special plants again
  1826.                                         if CheckForSpecialPlants() then
  1827.                                             isAutoPlantEnabled = false
  1828.                                             if autoPlantThread then
  1829.                                                 task.cancel(autoPlantThread)
  1830.                                                 autoPlantThread = nil
  1831.                                             end
  1832.                                             return
  1833.                                         end
  1834.                                        
  1835.                                         currentPlantCount = #playerPlot.Important.Plants_Physical:GetChildren()
  1836.                                         if currentPlantCount >= 50 then
  1837.                                             isAutoPlantEnabled = false
  1838.                                             if autoPlantThread then
  1839.                                                 task.cancel(autoPlantThread)
  1840.                                                 autoPlantThread = nil
  1841.                                             end
  1842.                                             return
  1843.                                         end
  1844.                                     end
  1845.                                    
  1846.                                     -- Find tool by name pattern instead of UUID
  1847.                                     local seedTool = nil
  1848.                                     for _, tool in ipairs(player.Backpack:GetChildren()) do
  1849.                                         -- Only consider tools tagged as Seed
  1850.                                         if tool:GetAttribute("ItemType") == "Seed" then
  1851.                                             -- Match by the Seed attribute
  1852.                                             if tool:GetAttribute("Seed") == seedInfo.name then
  1853.                                                 seedTool = tool
  1854.                                                 break
  1855.                                             end
  1856.                                             -- Fallback: tool name contains seed name (case-insensitive)
  1857.                                             if tool.Name:lower():find(seedInfo.name:lower()) then
  1858.                                                 seedTool = tool
  1859.                                                 break
  1860.                                             end
  1861.                                         end
  1862.                                     end
  1863.                                    
  1864.                                     if seedTool then
  1865.                                         -- Equip the seed
  1866.                                         seedTool.Parent = player.Character
  1867.                                         task.wait(0.5)
  1868.                                        
  1869.                                         -- Calculate how many more plants we can place (with safety margin)
  1870.                                         local remainingSlots = 50 - currentPlantCount
  1871.                                        
  1872.                                         -- Use each Can_Plant position with offset
  1873.                                         for i, spot in ipairs(plantSpots) do
  1874.                                             -- Stop if we hit near the limit
  1875.                                             if currentPlantCount >= 50 or remainingSlots <= 0 then
  1876.                                                 -- Turn off auto-plant functionality
  1877.                                                 isAutoPlantEnabled = false
  1878.                                                 if autoPlantThread then
  1879.                                                     task.cancel(autoPlantThread)
  1880.                                                     autoPlantThread = nil
  1881.                                                 end
  1882.                                                 break
  1883.                                             end
  1884.                                            
  1885.                                             -- Stop if we run out of seeds
  1886.                                             if seedInfo.quantity <= 0 then
  1887.                                                 break
  1888.                                             end
  1889.                                            
  1890.                                             -- Create planting position with offset
  1891.                                             local plantPosition = Vector3.new(
  1892.                                                 spot.Position.X,
  1893.                                                 spot.Position.Y,
  1894.                                                 spot.Position.Z + 7
  1895.                                             )
  1896.                                            
  1897.                                             -- Plant the seed
  1898.                                             ReplicatedStorage.GameEvents.Plant_RE:FireServer(plantPosition, seedInfo.name)
  1899.                                            
  1900.                                             -- Short wait between plants
  1901.                                             task.wait(0.1)
  1902.                                            
  1903.                                             -- Update our counters
  1904.                                             seedInfo.quantity = seedInfo.quantity - 1
  1905.                                             currentPlantCount = currentPlantCount + 1
  1906.                                             remainingSlots = remainingSlots - 1
  1907.                                            
  1908.                                             -- Recheck plant count every 10 plants as safety measure
  1909.                                             if i % 10 == 0 then
  1910.                                                 if playerPlot:FindFirstChild("Important") then
  1911.                                                     -- Check for special plants again
  1912.                                                     if CheckForSpecialPlants() then
  1913.                                                         isAutoPlantEnabled = false
  1914.                                                         if autoPlantThread then
  1915.                                                             task.cancel(autoPlantThread)
  1916.                                                             autoPlantThread = nil
  1917.                                                         end
  1918.                                                         break
  1919.                                                     end
  1920.                                                    
  1921.                                                     currentPlantCount = #playerPlot.Important.Plants_Physical:GetChildren()
  1922.                                                     remainingSlots = 50 - currentPlantCount
  1923.                                                    
  1924.                                                     if currentPlantCount >= 50 then
  1925.                                                         isAutoPlantEnabled = false
  1926.                                                         if autoPlantThread then
  1927.                                                             task.cancel(autoPlantThread)
  1928.                                                             autoPlantThread = nil
  1929.                                                         end
  1930.                                                         break
  1931.                                                     end
  1932.                                                 end
  1933.                                             end
  1934.                                         end
  1935.                                        
  1936.                                         -- Unequip when done
  1937.                                         if player.Character:FindFirstChild(seedTool.Name) then
  1938.                                             seedTool.Parent = player.Backpack
  1939.                                         end
  1940.                                     end
  1941.                                 end
  1942.                             end
  1943.                         end
  1944.                     end
  1945.                 end)
  1946.                
  1947.                 -- Wait before checking again
  1948.                 task.wait(1)
  1949.             end
  1950.             autoPlantThread = nil
  1951.         end)
  1952.     else
  1953.         if autoPlantThread then
  1954.             task.cancel(autoPlantThread)
  1955.         end
  1956.         autoPlantThread = nil
  1957.     end
  1958.    
  1959.     return isAutoPlantEnabled
  1960. end
  1961.  
  1962. function Auto_Delete_Plant()
  1963.     isAutoDeletePlantEnabled = not isAutoDeletePlantEnabled
  1964.  
  1965.     -- If we know there are no more plants to delete, don't even start
  1966.     if noMorePlantsToDelete and isAutoDeletePlantEnabled then
  1967.         isAutoDeletePlantEnabled = false
  1968.         return false
  1969.     end
  1970.  
  1971.     if isAutoDeletePlantEnabled then
  1972.         autoDeletePlantThread = spawn(function()
  1973.             local Remove_Item = game.ReplicatedStorage.GameEvents:WaitForChild("Remove_Item")
  1974.             local player = game.Players.LocalPlayer
  1975.             local consecutiveEmptyCycles = 0  -- Counter for consecutive cycles with nothing to delete
  1976.  
  1977.             while isAutoDeletePlantEnabled do
  1978.                 local deletedAny = false
  1979.                 pcall(function()
  1980.                     local playerPlot = GetFarm(player)
  1981.                     if playerPlot
  1982.                        and playerPlot:FindFirstChild("Important")
  1983.                        and playerPlot.Important:FindFirstChild("Plants_Physical") then
  1984.  
  1985.                         -- Equip the shovel if it's not already equipped
  1986.                         local backpack = player:FindFirstChild("Backpack")
  1987.                         if backpack
  1988.                            and not player.Character:FindFirstChild("Shovel [Destroy Plants]") then
  1989.                             local shovel = backpack:FindFirstChild("Shovel [Destroy Plants]")
  1990.                             if shovel then
  1991.                                 shovel.Parent = player.Character
  1992.                                 task.wait(0.2)
  1993.                             end
  1994.                         end
  1995.  
  1996.                         -- Loop through all plants in your plot
  1997.                         for _, plant in ipairs(playerPlot.Important.Plants_Physical:GetChildren()) do
  1998.                             if Delete_Plants[plant.Name] then
  1999.                                 if plant:GetAttribute("Favorited") then
  2000.                                     -- Skip favorited plants
  2001.                                 else
  2002.                                     -- Find the numbered child (e.g. plant["1"])
  2003.                                     local toDelete
  2004.                                     for _, child in ipairs(plant:GetChildren()) do
  2005.                                         if tonumber(child.Name) then
  2006.                                             toDelete = child
  2007.                                             break
  2008.                                         end
  2009.                                     end
  2010.  
  2011.                                     if toDelete then
  2012.                                         Remove_Item:FireServer(toDelete)
  2013.                                         deletedAny = true
  2014.                                         task.wait(0.2)
  2015.                                     end
  2016.                                 end
  2017.                             end
  2018.                         end
  2019.                     end
  2020.                 end)
  2021.  
  2022.                 if not deletedAny then
  2023.                     -- If nothing was deleted, unequip the shovel
  2024.                     local char = player.Character
  2025.                     local backpack = player:FindFirstChild("Backpack")
  2026.                     if char and backpack then
  2027.                         local shovel = char:FindFirstChild("Shovel [Destroy Plants]")
  2028.                         if shovel then
  2029.                             shovel.Parent = backpack
  2030.                         end
  2031.                     end
  2032.                    
  2033.                     -- Increment empty cycle counter
  2034.                     consecutiveEmptyCycles = consecutiveEmptyCycles + 1
  2035.                    
  2036.                     -- If we've had 3 consecutive empty cycles, set the global flag and turn off the function
  2037.                     if consecutiveEmptyCycles >= 3 then
  2038.                         noMorePlantsToDelete = true
  2039.                         isAutoDeletePlantEnabled = false
  2040.                         break
  2041.                     end
  2042.                    
  2043.                     -- Wait 60 seconds before next check
  2044.                     task.wait(60)
  2045.                 else
  2046.                     -- Reset counter and the noMorePlantsToDelete flag if we deleted something
  2047.                     consecutiveEmptyCycles = 0
  2048.                     noMorePlantsToDelete = false
  2049.                     -- Wait 5 seconds before next check
  2050.                     task.wait(5)
  2051.                 end
  2052.             end
  2053.  
  2054.             -- Make sure to unequip the shovel when we're done
  2055.             pcall(function()
  2056.                 local char = player.Character
  2057.                 local backpack = player:FindFirstChild("Backpack")
  2058.                 if char and backpack then
  2059.                     local shovel = char:FindFirstChild("Shovel [Destroy Plants]")
  2060.                     if shovel then
  2061.                         shovel.Parent = backpack
  2062.                     end
  2063.                 end
  2064.             end)
  2065.  
  2066.             autoDeletePlantThread = nil
  2067.         end)
  2068.     else
  2069.         -- Turn off and clean up
  2070.         if autoDeletePlantThread then
  2071.             task.cancel(autoDeletePlantThread)
  2072.         end
  2073.        
  2074.         -- Make sure to unequip the shovel
  2075.         pcall(function()
  2076.             local char = player.Character
  2077.             local backpack = player:FindFirstChild("Backpack")
  2078.             if char and backpack then
  2079.                 local shovel = char:FindFirstChild("Shovel [Destroy Plants]")
  2080.                 if shovel then
  2081.                     shovel.Parent = backpack
  2082.                 end
  2083.             end
  2084.         end)
  2085.        
  2086.         autoDeletePlantThread = nil
  2087.     end
  2088.  
  2089.     return isAutoDeletePlantEnabled
  2090. end
  2091.  
  2092.  
  2093. function Auto_Feed_Pet()
  2094.     isAutoFeedEnabled = not isAutoFeedEnabled
  2095.  
  2096.     if isAutoFeedEnabled then
  2097.         autoFeedThread = spawn(function()
  2098.             -- Get direct reference to remote
  2099.             local petRemote = ReplicatedStorage:WaitForChild("GameEvents"):WaitForChild("ActivePetService")
  2100.             local player = Players.LocalPlayer
  2101.            
  2102.             while isAutoFeedEnabled do
  2103.                 local allPetsFullyFed = true
  2104.                
  2105.                 pcall(function()
  2106.                     -- Get pet data directly from datastore
  2107.                     local petData = ActivePetsService:GetPlayerDatastorePetData(player.Name)
  2108.                     if not petData then return end
  2109.                    
  2110.                     -- Check if we have equipped pets
  2111.                     if not petData.EquippedPets or #petData.EquippedPets == 0 then return end
  2112.                    
  2113.                     -- Check for pet inventory
  2114.                     if not petData.PetInventory or not petData.PetInventory.Data then return end
  2115.                    
  2116.                     local petInventory = petData.PetInventory.Data
  2117.                    
  2118.                     -- Get reference to PetList for correct max hunger values
  2119.                     local PetList = require(ReplicatedStorage.Data.PetRegistry.PetList)
  2120.                    
  2121.                     -- Find hungry pets using the equipped pets list directly
  2122.                     local hungryPets = {}
  2123.                     for _, uuid in ipairs(petData.EquippedPets) do
  2124.                         local pet = petInventory[uuid]
  2125.                         if pet and pet.PetData then
  2126.                             local hunger = pet.PetData.Hunger or 0
  2127.                             local petType = pet.PetType
  2128.                            
  2129.                             -- Get the pet's specific max hunger from PetList
  2130.                             local maxHunger = (PetList[petType] and PetList[petType].DefaultHunger) or 30000
  2131.                            
  2132.                             -- Only add to hungry list if below 30% of its max hunger
  2133.                             if hunger < maxHunger * 0.4 then
  2134.                                 allPetsFullyFed = false
  2135.                                 table.insert(hungryPets, {
  2136.                                     uuid = uuid,
  2137.                                     hunger = hunger,
  2138.                                     type = petType,
  2139.                                     name = pet.PetData.Name or "Unknown Pet",
  2140.                                     maxHunger = maxHunger
  2141.                                 })
  2142.                             end
  2143.                         end
  2144.                     end
  2145.                    
  2146.                     -- Force allPetsFullyFed to false if we found any hungry pets
  2147.                     if #hungryPets > 0 then
  2148.                         allPetsFullyFed = false
  2149.                     end
  2150.                    
  2151.                     -- Sort by hunger percentage (lowest first)
  2152.                     table.sort(hungryPets, function(a, b)
  2153.                         return (a.hunger / a.maxHunger) < (b.hunger / b.maxHunger)
  2154.                     end)
  2155.                    
  2156.                     if #hungryPets == 0 then return end
  2157.                    
  2158.                     -- Get all items from inventory that can be used as food
  2159.                     local backpack = player:FindFirstChild("Backpack")
  2160.                     local character = player.Character
  2161.                     if not backpack or not character then return end
  2162.                    
  2163.                     -- Get food items that have "kg" in the name, are under 10kg, and not favorited
  2164.                     local foodTools = {}
  2165.                     for _, tool in ipairs(backpack:GetChildren()) do
  2166.                         if tool:IsA("Tool") then
  2167.                             local toolName = tool.Name
  2168.                            
  2169.                             -- Skip if favorited
  2170.                             if tool:GetAttribute("IsFavorite") == true then continue end
  2171.                            
  2172.                             -- Look for items with "kg" in the name (foods)
  2173.                             if toolName:find("kg") then
  2174.                                 -- Try to extract the weight value
  2175.                                 local weightStr = toolName:match("(%d+%.?%d*)kg")
  2176.                                 local weight = tonumber(weightStr)
  2177.                                
  2178.                                 -- Only use items under 20kg
  2179.                                 if weight and weight < 20 then
  2180.                                     table.insert(foodTools, tool)
  2181.                                 end
  2182.                             end
  2183.                         end
  2184.                     end
  2185.                    
  2186.                     if #foodTools == 0 then return end
  2187.                    
  2188.                     -- Feed pets one at a time
  2189.                     for _, pet in ipairs(hungryPets) do
  2190.                         -- Feed the pet with up to 3 food items
  2191.                         for i = 1, math.min(3, #foodTools) do
  2192.                             local food = foodTools[i]
  2193.                            
  2194.                             -- Unequip any currently equipped tool
  2195.                             local equipped = character:FindFirstChildOfClass("Tool")
  2196.                             if equipped then
  2197.                                 equipped.Parent = backpack
  2198.                                 task.wait(0.2)
  2199.                             end
  2200.                            
  2201.                             -- Equip food
  2202.                             food.Parent = character
  2203.                             task.wait(0.3)
  2204.                            
  2205.                             -- Feed the pet
  2206.                             petRemote:FireServer("Feed", pet.uuid)
  2207.                             task.wait(0.5)
  2208.                            
  2209.                             -- Check if pet is now fed
  2210.                             local updatedPetData = ActivePetsService:GetPetData(player.Name, pet.uuid)
  2211.                             if updatedPetData and updatedPetData.PetData then
  2212.                                 local newHunger = updatedPetData.PetData.Hunger or 0
  2213.                                
  2214.                                 if newHunger >= pet.maxHunger * 0.9 then
  2215.                                     break  -- Stop feeding this pet if it's now full
  2216.                                 end
  2217.                             end
  2218.                         end
  2219.                        
  2220.                         -- Return any equipped tool to backpack
  2221.                         local equipped = character:FindFirstChildOfClass("Tool")
  2222.                         if equipped then
  2223.                             equipped.Parent = backpack
  2224.                         end
  2225.                        
  2226.                         task.wait(0.5)  -- Wait between pets
  2227.                     end
  2228.                 end)
  2229.                
  2230.                 -- Make sure we check if we found hungry pets again before waiting
  2231.                 if allPetsFullyFed then
  2232.                     task.wait(30)  -- Wait 30 seconds when all pets are fed
  2233.                 else
  2234.                     task.wait(5)   -- Wait time when pets need feeding
  2235.                 end
  2236.             end
  2237.            
  2238.             autoFeedThread = nil
  2239.         end)
  2240.     else
  2241.         if autoFeedThread then
  2242.             task.cancel(autoFeedThread)
  2243.         end
  2244.         autoFeedThread = nil
  2245.     end
  2246.  
  2247.     return isAutoFeedEnabled
  2248. end
  2249.  
  2250. function Auto_PlaceEgg()
  2251.     isAutoPlaceEggEnabled = not isAutoPlaceEggEnabled
  2252.  
  2253.     if isAutoPlaceEggEnabled then
  2254.         autoPlaceEggThread = spawn(function()
  2255.             while isAutoPlaceEggEnabled do
  2256.                 pcall(function()
  2257.                     local player = game.Players.LocalPlayer
  2258.                     local character = player.Character
  2259.                     if not character then return end
  2260.                    
  2261.                     -- Get player data
  2262.                     local DataService = require(game.ReplicatedStorage.Modules.DataService)
  2263.                     local playerData = DataService:GetData()
  2264.                    
  2265.                     if not playerData then return end
  2266.                    
  2267.                     -- Find player plot
  2268.                     local playerPlot = GetFarm(player)
  2269.                     if not playerPlot then return end
  2270.                    
  2271.                     -- Find Can_Plant
  2272.                     local canPlant
  2273.                     for _, obj in pairs(playerPlot:GetDescendants()) do
  2274.                         if obj.Name == "Can_Plant" and obj:IsA("BasePart") then
  2275.                             canPlant = obj
  2276.                             break -- Use first one found
  2277.                         end
  2278.                     end
  2279.                    
  2280.                     if not canPlant then return end
  2281.                    
  2282.                     -- Count existing eggs
  2283.                     local currentEggCount = 0
  2284.                     local existingEggs = {}
  2285.                    
  2286.                     for _, obj in pairs(workspace:GetDescendants()) do
  2287.                         if obj:HasTag("PetEggServer") and obj:GetAttribute("OWNER") == player.Name then
  2288.                             currentEggCount = currentEggCount + 1
  2289.                             existingEggs[obj:GetAttribute("OBJECT_UUID")] = obj
  2290.                         end
  2291.                     end
  2292.                    
  2293.                     -- Check if we have reached the maximum
  2294.                     local maxEggSlots = playerData.PetsData.MutableStats.MaxEggsInFarm
  2295.                    
  2296.                     -- Hatch ready eggs first
  2297.                     for _, eggObj in pairs(existingEggs) do
  2298.                         if eggObj:GetAttribute("TimeToHatch") and eggObj:GetAttribute("TimeToHatch") <= 0 then
  2299.                             game.ReplicatedStorage.GameEvents.PetEggService:FireServer("HatchPet", eggObj)
  2300.                             task.wait(1)
  2301.                             return -- Only hatch one egg per cycle
  2302.                         end
  2303.                     end
  2304.                    
  2305.                     -- Place new eggs if we have room
  2306.                     if currentEggCount < maxEggSlots then
  2307.                         -- First unequip any current tool
  2308.                         if character:FindFirstChildOfClass("Tool") then
  2309.                             for _, tool in pairs(character:GetChildren()) do
  2310.                                 if tool:IsA("Tool") then
  2311.                                     tool.Parent = player.Backpack
  2312.                                 end
  2313.                             end
  2314.                             task.wait(1)
  2315.                         end
  2316.                        
  2317.                         -- Use the global egg index for detection
  2318.                         for _, tool in ipairs(player.Backpack:GetChildren()) do
  2319.                             local isEggTool = false
  2320.                            
  2321.                             -- Primary check: ItemType attribute must be PetEgg
  2322.                             if tool:GetAttribute("ItemType") == "PetEgg" then
  2323.                                 isEggTool = true
  2324.                             end
  2325.                            
  2326.                             -- Secondary check: Use the egg index table
  2327.                             if not isEggTool and eggIndex[tool.Name] then
  2328.                                 isEggTool = true
  2329.                             end
  2330.                            
  2331.                             -- Explicitly exclude pet tools
  2332.                             if tool:GetAttribute("ItemType") == "Pet" then
  2333.                                 isEggTool = false
  2334.                             end
  2335.                            
  2336.                             if isEggTool then
  2337.                                 -- Use more direct equip approach
  2338.                                 tool.Parent = character
  2339.                                 task.wait(1) -- Extended wait after equipping
  2340.                                
  2341.                                 -- Double check equip
  2342.                                 if character:FindFirstChild(tool.Name) then
  2343.                                     -- Use a simple position with random offset
  2344.                                     local basePosition = canPlant.Position
  2345.                                     local randX = math.random(-10, 10)
  2346.                                     local randZ = math.random(-10, 10)
  2347.                                    
  2348.                                     local eggPosition = Vector3.new(
  2349.                                         basePosition.X + randX,
  2350.                                         basePosition.Y,
  2351.                                         basePosition.Z + randZ
  2352.                                     )
  2353.                                    
  2354.                                     -- Try with both possible remote names to be safe
  2355.                                     local success = pcall(function()
  2356.                                         game.ReplicatedStorage.GameEvents.PetEggService:FireServer("CreateEgg", eggPosition)
  2357.                                     end)
  2358.                                    
  2359.                                     if not success then
  2360.                                         pcall(function()
  2361.                                             game.ReplicatedStorage.GameEvents.PetEggService:FireServer("PlaceEgg", eggPosition)
  2362.                                         end)
  2363.                                     end
  2364.                                    
  2365.                                     task.wait(1) -- Extended wait after placement attempt
  2366.                                    
  2367.                                     -- Return to backpack regardless
  2368.                                     if character:FindFirstChild(tool.Name) then
  2369.                                         tool.Parent = player.Backpack
  2370.                                     end
  2371.                                    
  2372.                                     return -- Only place one egg per cycle
  2373.                                 end
  2374.                             end
  2375.                         end
  2376.                     end
  2377.                 end)
  2378.                
  2379.                 -- Wait between cycles
  2380.                 task.wait(1)
  2381.             end
  2382.         end)
  2383.     else
  2384.         if autoPlaceEggThread then
  2385.             task.cancel(autoPlaceEggThread)
  2386.             autoPlaceEggThread = nil
  2387.         end
  2388.     end
  2389.  
  2390.     return isAutoPlaceEggEnabled
  2391. end
  2392.  
  2393.  
  2394. -- AUTO-SELL PET FUNCTION
  2395. function Auto_Sell_Pet()
  2396.     isAutoSellPetEnabled = not isAutoSellPetEnabled
  2397.    
  2398.     if isAutoSellPetEnabled then
  2399.         autoSellPetThread = spawn(function()
  2400.             local SellPet_RE = ReplicatedStorage.GameEvents.SellPet_RE
  2401.             local favoriteRemote = ReplicatedStorage:WaitForChild("GameEvents"):WaitForChild("Favorite_Item")
  2402.            
  2403.             -- Counter for cycling through pets
  2404.             local currentPetIndex = 1
  2405.            
  2406.             while isAutoSellPetEnabled do
  2407.                 local foundPetToProcess = false
  2408.                
  2409.                 pcall(function()
  2410.                     local DataService = require(ReplicatedStorage.Modules.DataService)
  2411.                     local playerData = DataService:GetData()
  2412.                    
  2413.                     if not playerData or not playerData.PetsData or not playerData.PetsData.PetInventory
  2414.                        or not playerData.PetsData.PetInventory.Data then
  2415.                         return
  2416.                     end
  2417.                    
  2418.                     local petInventoryData = playerData.PetsData.PetInventory.Data
  2419.                     local backpack = player.Backpack
  2420.                     local character = player.Character
  2421.                    
  2422.                     if not backpack or not character then return end
  2423.                    
  2424.                     -- First unequip any currently equipped tool
  2425.                     local equipped = character:FindFirstChildOfClass("Tool")
  2426.                     if equipped then
  2427.                         equipped.Parent = backpack
  2428.                         task.wait(0.2)
  2429.                     end
  2430.                    
  2431.                     -- Get all pet tools from backpack
  2432.                     local petTools = {}
  2433.                     for _, tool in pairs(backpack:GetChildren()) do
  2434.                         if tool:IsA("Tool") and tool:GetAttribute("ItemType") == "Pet" then
  2435.                             table.insert(petTools, tool)
  2436.                         end
  2437.                     end
  2438.                    
  2439.                     -- If no pet tools found, return
  2440.                     if #petTools == 0 then
  2441.                         return
  2442.                     end
  2443.                    
  2444.                     -- Reset index if it's out of bounds
  2445.                     if currentPetIndex > #petTools then
  2446.                         currentPetIndex = 1
  2447.                         return
  2448.                     end
  2449.                    
  2450.                     -- Get the current pet to process
  2451.                     local currentTool = petTools[currentPetIndex]
  2452.                     local petName = currentTool.Name
  2453.                    
  2454.                     foundPetToProcess = true
  2455.                    
  2456.                     -- Check if this pet is already favorited
  2457.                     local isFavoritedInAttribute = currentTool:GetAttribute("Favorite") == true
  2458.                    
  2459.                     -- Also check in the data
  2460.                     local uuid = currentTool:GetAttribute("ITEM_UUID")
  2461.                     local isFavoritedInData = false
  2462.                     if uuid and petInventoryData[uuid] and petInventoryData[uuid].PetData then
  2463.                         isFavoritedInData = petInventoryData[uuid].PetData.IsFavorite == true
  2464.                     end
  2465.                    
  2466.                     -- If it's already favorited in either place, skip processing
  2467.                     if isFavoritedInAttribute or isFavoritedInData then
  2468.                         currentPetIndex = currentPetIndex + 1
  2469.                         return
  2470.                     end
  2471.                    
  2472.                     -- Extract pet type from name (before first bracket)
  2473.                     local petType = petName:match("^([^%[]+)")
  2474.                     if petType then petType = petType:gsub("%s+$", "") end
  2475.                    
  2476.                     -- Extract weight from name
  2477.                     local petWeight = tonumber(petName:match("(%d+%.?%d*)%s*KG")) or 0
  2478.                    
  2479.                     -- Extract age from name
  2480.                     local age = tonumber(petName:match("Age%s+(%d+)")) or 1
  2481.                    
  2482.                     -- Check if this pet should be sold based on type and weight
  2483.                     local shouldSell = false
  2484.                     if Sell_Pets[petType] == true then
  2485.                         shouldSell = petWeight <= MAX_PET_KG and age < 5
  2486.                     end
  2487.                    
  2488.                     if shouldSell then
  2489.                         -- Equip and sell
  2490.                         currentTool.Parent = character
  2491.                         task.wait(0.5)
  2492.                         SellPet_RE:FireServer(currentTool)
  2493.                         task.wait(0.5)
  2494.                        
  2495.                         -- Return to backpack if needed
  2496.                         if character:FindFirstChild(currentTool.Name) then
  2497.                             currentTool.Parent = backpack
  2498.                         end
  2499.                     else
  2500.                         -- Only favorite if not already favorited
  2501.                         favoriteRemote:FireServer(currentTool)
  2502.                         task.wait(0.5)
  2503.                     end
  2504.                    
  2505.                     -- Increment the pet index for next time
  2506.                     currentPetIndex = currentPetIndex + 1
  2507.                 end)
  2508.                
  2509.                 -- If no pets were found to process, wait longer
  2510.                 if not foundPetToProcess then
  2511.                     task.wait(10)
  2512.                     currentPetIndex = 1 -- Reset index after waiting
  2513.                 else
  2514.                     task.wait(1)
  2515.                 end
  2516.             end
  2517.            
  2518.             autoSellPetThread = nil
  2519.         end)
  2520.     else
  2521.         if autoSellPetThread then
  2522.             task.cancel(autoSellPetThread)
  2523.         end
  2524.         autoSellPetThread = nil
  2525.     end
  2526.  
  2527.     return isAutoSellPetEnabled
  2528. end
  2529.  
  2530.  
  2531. function Auto_Submit_Honey()
  2532.     isAutoSubmitHoneyEnabled = not isAutoSubmitHoneyEnabled
  2533.  
  2534.     if isAutoSubmitHoneyEnabled then
  2535.         autoSubmitHoneyThread = spawn(function()
  2536.             while isAutoSubmitHoneyEnabled do
  2537.                 pcall(function()
  2538.                     -- Get player data
  2539.                     local DataService = require(ReplicatedStorage.Modules.DataService)
  2540.                     local playerData = DataService:GetData()
  2541.                    
  2542.                     if not playerData then return end
  2543.                    
  2544.                     -- Check machine state
  2545.                     local machineState = "empty"
  2546.                     if playerData.HoneyMachine then
  2547.                         if playerData.HoneyMachine.IsRunning == true and playerData.HoneyMachine.TimeLeft and playerData.HoneyMachine.TimeLeft > 0 then
  2548.                             machineState = "processing"
  2549.                         elseif playerData.HoneyMachine.HoneyStored and playerData.HoneyMachine.HoneyStored > 0 then
  2550.                             machineState = "readyToCollect"
  2551.                         end
  2552.                     end
  2553.                    
  2554.                     -- Handle each machine state
  2555.                     if machineState == "processing" then
  2556.                         -- Machine is processing, just wait
  2557.                         task.wait(10)
  2558.                         return
  2559.                    
  2560.                     elseif machineState == "readyToCollect" then
  2561.                         -- Machine has honey to collect, just fire the remote
  2562.                         local honeyMachineRemote = ReplicatedStorage:WaitForChild("GameEvents"):WaitForChild("HoneyMachineService_RE")
  2563.                         honeyMachineRemote:FireServer("MachineInteract")
  2564.                         task.wait(1)
  2565.                         return
  2566.                    
  2567.                     elseif machineState == "empty" and playerData.InventoryData then
  2568.                         -- Machine is empty, try to find a pollinated fruit to submit
  2569.                        
  2570.                         -- Find pollinated fruits in inventory
  2571.                         local pollinatedFruit = nil
  2572.                         for uuid, itemData in pairs(playerData.InventoryData) do
  2573.                             if itemData.ItemType == "Holdable" and itemData.ItemData then
  2574.                                 -- Check if item has the Pollinated mutation and is NOT favorited
  2575.                                 if itemData.ItemData.MutationString and
  2576.                                    itemData.ItemData.MutationString:find("Pollinated") and
  2577.                                    not itemData.ItemData.IsFavorite then
  2578.                                    
  2579.                                     -- Find the tool in the backpack
  2580.                                     for _, t in pairs(player.Backpack:GetChildren()) do
  2581.                                         if t:IsA("Tool") and t:GetAttribute("ITEM_UUID") == uuid then
  2582.                                             -- Double-check it's not favorited using the tool attribute
  2583.                                             if not t:GetAttribute("Favorite") and
  2584.                                                not t:GetAttribute("IsFavorite") then
  2585.                                                 pollinatedFruit = t
  2586.                                                 break
  2587.                                             end
  2588.                                         end
  2589.                                     end
  2590.                                    
  2591.                                     if pollinatedFruit then break end
  2592.                                 end
  2593.                             end
  2594.                         end
  2595.  
  2596.                         -- If we found a pollinated fruit, equip and submit it
  2597.                         if pollinatedFruit then
  2598.                             -- Ensure character exists
  2599.                             local char = player.Character or player.CharacterAdded:Wait()
  2600.                             if not char then return end
  2601.                            
  2602.                             -- Equip the fruit
  2603.                             pollinatedFruit.Parent = char
  2604.                             task.wait(0.3) -- Wait to ensure it equips
  2605.                            
  2606.                             -- Submit the fruit to the honey machine
  2607.                             local honeyMachineRemote = ReplicatedStorage:WaitForChild("GameEvents"):WaitForChild("HoneyMachineService_RE")
  2608.                             honeyMachineRemote:FireServer("MachineInteract")
  2609.                            
  2610.                             -- Return tool to backpack
  2611.                             task.wait(0.5)
  2612.                             if pollinatedFruit.Parent == char then
  2613.                                 pollinatedFruit.Parent = player.Backpack
  2614.                             end
  2615.                         else
  2616.                             -- No pollinated fruit found, wait
  2617.                             task.wait(5)
  2618.                         end
  2619.                     end
  2620.                 end)
  2621.                
  2622.                 task.wait(1) -- Base wait between cycles
  2623.             end
  2624.            
  2625.             autoSubmitHoneyThread = nil
  2626.         end)
  2627.     else
  2628.         if autoSubmitHoneyThread then
  2629.             task.cancel(autoSubmitHoneyThread)
  2630.         end
  2631.         autoSubmitHoneyThread = nil
  2632.     end
  2633.  
  2634.     return isAutoSubmitHoneyEnabled
  2635. end
  2636.  
  2637.  
  2638. -- AUTO-BUY HONEY SHOP FUNCTION
  2639. function Auto_BuyHoneyShop()
  2640.     isAutoBuyHoneyShopEnabled = not isAutoBuyHoneyShopEnabled
  2641.    
  2642.     if isAutoBuyHoneyShopEnabled then
  2643.         autoBuyHoneyShopThread = spawn(function()
  2644.             while isAutoBuyHoneyShopEnabled do
  2645.                 pcall(function()
  2646.                     -- Get player data
  2647.                     local DataService = require(ReplicatedStorage.Modules.DataService)
  2648.                     local playerData = DataService:GetData()
  2649.                    
  2650.                     if playerData and playerData.EventShopStock and playerData.EventShopStock.Stocks then
  2651.                         -- Create a list of items to buy based on priority
  2652.                         local itemsToBuy = {}
  2653.                        
  2654.                         -- Collect available items
  2655.                         for itemName, stockData in pairs(playerData.EventShopStock.Stocks) do
  2656.                             -- For ANY item in stock, if we don't have it in our Buy_HoneyShop table yet, add it
  2657.                             if Buy_HoneyShop[itemName] == nil then
  2658.                                 Buy_HoneyShop[itemName] = {buy = true, priority = 50} -- Default priority
  2659.                             end
  2660.                            
  2661.                             -- If it's set to buy and in stock, add to our list
  2662.                             local itemConfig = Buy_HoneyShop[itemName]
  2663.                             if itemConfig.buy == true and stockData.Stock > 0 then
  2664.                                 table.insert(itemsToBuy, {
  2665.                                     name = itemName,
  2666.                                     stock = stockData.Stock,
  2667.                                     priority = itemConfig.priority
  2668.                                 })
  2669.                             end
  2670.                         end
  2671.                        
  2672.                         -- Sort by priority (lower number = higher priority)
  2673.                         table.sort(itemsToBuy, function(a, b)
  2674.                             return a.priority < b.priority
  2675.                         end)
  2676.                        
  2677.                         -- Buy items in priority order
  2678.                         for _, item in ipairs(itemsToBuy) do
  2679.                             -- Try to buy all available stock
  2680.                             local stockAmount = item.stock
  2681.                             for i = 1, stockAmount do
  2682.                                 -- Make purchase request
  2683.                                 ReplicatedStorage.GameEvents.BuyEventShopStock:FireServer(item.name)
  2684.                                
  2685.                                 -- Wait between purchases
  2686.                                 task.wait(0.5)
  2687.                                
  2688.                                 -- Check if purchase was successful
  2689.                                 local updatedData = DataService:GetData()
  2690.                                 if updatedData and updatedData.EventShopStock and
  2691.                                    updatedData.EventShopStock.Stocks[item.name] then
  2692.                                     local newStock = updatedData.EventShopStock.Stocks[item.name].Stock
  2693.                                     if newStock < stockAmount then
  2694.                                         stockAmount = newStock  -- Update remaining stock
  2695.                                         if stockAmount == 0 then break end
  2696.                                     else
  2697.                                         task.wait(1)
  2698.                                         break
  2699.                                     end
  2700.                                 end
  2701.                             end
  2702.                         end
  2703.                     end
  2704.                 end)
  2705.                
  2706.                 -- Check for honey shop items every 5 seconds
  2707.                 task.wait(5)
  2708.             end
  2709.             autoBuyHoneyShopThread = nil
  2710.         end)
  2711.     else
  2712.         if autoBuyHoneyShopThread then
  2713.             task.cancel(autoBuyHoneyShopThread)
  2714.             autoBuyHoneyShopThread = nil
  2715.         end
  2716.     end
  2717.    
  2718.     return isAutoBuyHoneyShopEnabled
  2719. end
  2720.  
  2721. -- Variables for gift system
  2722. local MIN_FRUIT_VALUE_TO_GIFT = 200000000000 -- 200 billion (default)
  2723. local MAX_FRUIT_VALUE_TO_GIFT = 900000000000 -- 900 billion (default)
  2724. local GIFT_FRUIT_AMOUNT = 1 -- Default number of fruits to gift
  2725. local isAutoGiftEnabled = false
  2726. local autoGiftThread = nil
  2727. local WAIT_FOR_GIFT_ACCEPTANCE = false
  2728.  
  2729. -- Create GUI for fruit gifting
  2730. local fruitGiftGui = Instance.new("ScreenGui")
  2731. fruitGiftGui.Name = "FruitGiftGui"
  2732. fruitGiftGui.ResetOnSpawn = false
  2733. fruitGiftGui.Parent = playerGui
  2734.  
  2735. local giftFrame = Instance.new("Frame")
  2736. giftFrame.Name = "GiftFrame"
  2737. giftFrame.Size = UDim2.new(0, 250, 0, 245)
  2738. giftFrame.Position = UDim2.new(0, 10, 0, 250)
  2739. giftFrame.BackgroundColor3 = Color3.fromRGB(45, 45, 65)
  2740. giftFrame.BackgroundTransparency = 0.1
  2741. giftFrame.BorderSizePixel = 0
  2742. giftFrame.Parent = fruitGiftGui
  2743. giftFrame.ClipsDescendants = true
  2744.  
  2745. -- Corner radius for main frame
  2746. local cornerRadius = Instance.new("UICorner")
  2747. cornerRadius.CornerRadius = UDim.new(0, 8)
  2748. cornerRadius.Parent = giftFrame
  2749.  
  2750. -- Title bar
  2751. local titleBar = Instance.new("Frame")
  2752. titleBar.Name = "TitleBar"
  2753. titleBar.Size = UDim2.new(1, 0, 0, 30)
  2754. titleBar.BackgroundColor3 = Color3.fromRGB(35, 35, 55)
  2755. titleBar.BorderSizePixel = 0
  2756. titleBar.Parent = giftFrame
  2757.  
  2758. -- Corner radius for title bar
  2759. local titleCorner = Instance.new("UICorner")
  2760. titleCorner.CornerRadius = UDim.new(0, 8)
  2761. titleCorner.Parent = titleBar
  2762.  
  2763. -- Title label
  2764. local titleLabel = Instance.new("TextLabel")
  2765. titleLabel.Name = "TitleLabel"
  2766. titleLabel.Size = UDim2.new(1, 0, 1, 0)
  2767. titleLabel.BackgroundTransparency = 1
  2768. titleLabel.Text = "Fruit Gifting"
  2769. titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  2770. titleLabel.Font = Enum.Font.GothamBold
  2771. titleLabel.TextSize = 16
  2772. titleLabel.Parent = titleBar
  2773.  
  2774. -- Gift amount section
  2775. local giftAmountLabel = Instance.new("TextLabel")
  2776. giftAmountLabel.Name = "GiftAmountLabel"
  2777. giftAmountLabel.Size = UDim2.new(0.6, 0, 0, 25)
  2778. giftAmountLabel.Position = UDim2.new(0.05, 0, 0, 40)
  2779. giftAmountLabel.BackgroundTransparency = 1
  2780. giftAmountLabel.Text = "Gift Amount:"
  2781. giftAmountLabel.TextColor3 = Color3.fromRGB(220, 220, 255)
  2782. giftAmountLabel.TextXAlignment = Enum.TextXAlignment.Left
  2783. giftAmountLabel.Font = Enum.Font.Gotham
  2784. giftAmountLabel.TextSize = 14
  2785. giftAmountLabel.Parent = giftFrame
  2786.  
  2787. local giftAmountInput = Instance.new("TextBox")
  2788. giftAmountInput.Name = "GiftAmountInput"
  2789. giftAmountInput.Size = UDim2.new(0.3, 0, 0, 25)
  2790. giftAmountInput.Position = UDim2.new(0.65, 0, 0, 40)
  2791. giftAmountInput.BackgroundColor3 = Color3.fromRGB(60, 60, 85)
  2792. giftAmountInput.BorderSizePixel = 0
  2793. giftAmountInput.Text = tostring(GIFT_FRUIT_AMOUNT)
  2794. giftAmountInput.TextColor3 = Color3.fromRGB(255, 255, 255)
  2795. giftAmountInput.Font = Enum.Font.Gotham
  2796. giftAmountInput.TextSize = 14
  2797. giftAmountInput.Parent = giftFrame
  2798.  
  2799. -- Input box corner radius
  2800. local amountCorner = Instance.new("UICorner")
  2801. amountCorner.CornerRadius = UDim.new(0, 6)
  2802. amountCorner.Parent = giftAmountInput
  2803.  
  2804. -- Min price section
  2805. local minPriceLabel = Instance.new("TextLabel")
  2806. minPriceLabel.Name = "MinPriceLabel"
  2807. minPriceLabel.Size = UDim2.new(0.6, 0, 0, 25)
  2808. minPriceLabel.Position = UDim2.new(0.05, 0, 0, 75)
  2809. minPriceLabel.BackgroundTransparency = 1
  2810. minPriceLabel.Text = "Min Value (B):"
  2811. minPriceLabel.TextColor3 = Color3.fromRGB(220, 220, 255)
  2812. minPriceLabel.TextXAlignment = Enum.TextXAlignment.Left
  2813. minPriceLabel.Font = Enum.Font.Gotham
  2814. minPriceLabel.TextSize = 14
  2815. minPriceLabel.Parent = giftFrame
  2816.  
  2817. local minPriceInput = Instance.new("TextBox")
  2818. minPriceInput.Name = "MinPriceInput"
  2819. minPriceInput.Size = UDim2.new(0.3, 0, 0, 25)
  2820. minPriceInput.Position = UDim2.new(0.65, 0, 0, 75)
  2821. minPriceInput.BackgroundColor3 = Color3.fromRGB(60, 60, 85)
  2822. minPriceInput.BorderSizePixel = 0
  2823. minPriceInput.Text = "200"  -- Default 200B
  2824. minPriceInput.TextColor3 = Color3.fromRGB(255, 255, 255)
  2825. minPriceInput.Font = Enum.Font.Gotham
  2826. minPriceInput.TextSize = 14
  2827. minPriceInput.Parent = giftFrame
  2828.  
  2829. -- Input box corner radius
  2830. local minCorner = Instance.new("UICorner")
  2831. minCorner.CornerRadius = UDim.new(0, 6)
  2832. minCorner.Parent = minPriceInput
  2833.  
  2834. -- Max price section
  2835. local maxPriceLabel = Instance.new("TextLabel")
  2836. maxPriceLabel.Name = "MaxPriceLabel"
  2837. maxPriceLabel.Size = UDim2.new(0.6, 0, 0, 25)
  2838. maxPriceLabel.Position = UDim2.new(0.05, 0, 0, 110)
  2839. maxPriceLabel.BackgroundTransparency = 1
  2840. maxPriceLabel.Text = "Max Value (B):"
  2841. maxPriceLabel.TextColor3 = Color3.fromRGB(220, 220, 255)
  2842. maxPriceLabel.TextXAlignment = Enum.TextXAlignment.Left
  2843. maxPriceLabel.Font = Enum.Font.Gotham
  2844. maxPriceLabel.TextSize = 14
  2845. maxPriceLabel.Parent = giftFrame
  2846.  
  2847. local maxPriceInput = Instance.new("TextBox")
  2848. maxPriceInput.Name = "MaxPriceInput"
  2849. maxPriceInput.Size = UDim2.new(0.3, 0, 0, 25)
  2850. maxPriceInput.Position = UDim2.new(0.65, 0, 0, 110)
  2851. maxPriceInput.BackgroundColor3 = Color3.fromRGB(60, 60, 85)
  2852. maxPriceInput.BorderSizePixel = 0
  2853. maxPriceInput.Text = "900"  -- Default 900B
  2854. maxPriceInput.TextColor3 = Color3.fromRGB(255, 255, 255)
  2855. maxPriceInput.Font = Enum.Font.Gotham
  2856. maxPriceInput.TextSize = 14
  2857. maxPriceInput.Parent = giftFrame
  2858.  
  2859. -- Input box corner radius
  2860. local maxCorner = Instance.new("UICorner")
  2861. maxCorner.CornerRadius = UDim.new(0, 6)
  2862. maxCorner.Parent = maxPriceInput
  2863.  
  2864. -- Wait for gift acceptance toggle
  2865. local waitAcceptLabel = Instance.new("TextLabel")
  2866. waitAcceptLabel.Name = "WaitAcceptLabel"
  2867. waitAcceptLabel.Size = UDim2.new(0.6, 0, 0, 25)
  2868. waitAcceptLabel.Position = UDim2.new(0.05, 0, 0, 145)
  2869. waitAcceptLabel.BackgroundTransparency = 1
  2870. waitAcceptLabel.Text = "Wait for Accept:"
  2871. waitAcceptLabel.TextColor3 = Color3.fromRGB(220, 220, 255)
  2872. waitAcceptLabel.TextXAlignment = Enum.TextXAlignment.Left
  2873. waitAcceptLabel.Font = Enum.Font.Gotham
  2874. waitAcceptLabel.TextSize = 14
  2875. waitAcceptLabel.Parent = giftFrame
  2876.  
  2877. -- Toggle button for wait for acceptance
  2878. local waitAcceptToggle = Instance.new("TextButton")
  2879. waitAcceptToggle.Name = "WaitAcceptToggle"
  2880. waitAcceptToggle.Size = UDim2.new(0.3, 0, 0, 25)
  2881. waitAcceptToggle.Position = UDim2.new(0.65, 0, 0, 145)
  2882. waitAcceptToggle.BackgroundColor3 = Color3.fromRGB(60, 60, 85)
  2883. waitAcceptToggle.BorderSizePixel = 0
  2884. waitAcceptToggle.Text = "OFF"
  2885. waitAcceptToggle.TextColor3 = Color3.fromRGB(255, 255, 255)
  2886. waitAcceptToggle.Font = Enum.Font.GothamBold
  2887. waitAcceptToggle.TextSize = 14
  2888. waitAcceptToggle.Parent = giftFrame
  2889.  
  2890. -- Toggle button corner radius
  2891. local waitToggleCorner = Instance.new("UICorner")
  2892. waitToggleCorner.CornerRadius = UDim.new(0, 6)
  2893. waitToggleCorner.Parent = waitAcceptToggle
  2894.  
  2895. -- Auto gift toggle section
  2896. local autoGiftLabel = Instance.new("TextLabel")
  2897. autoGiftLabel.Name = "AutoGiftLabel"
  2898. autoGiftLabel.Size = UDim2.new(0.6, 0, 0, 25)
  2899. autoGiftLabel.Position = UDim2.new(0.05, 0, 0, 180)
  2900. autoGiftLabel.BackgroundTransparency = 1
  2901. autoGiftLabel.Text = "Auto Gift:"
  2902. autoGiftLabel.TextColor3 = Color3.fromRGB(220, 220, 255)
  2903. autoGiftLabel.TextXAlignment = Enum.TextXAlignment.Left
  2904. autoGiftLabel.Font = Enum.Font.Gotham
  2905. autoGiftLabel.TextSize = 14
  2906. autoGiftLabel.Parent = giftFrame
  2907.  
  2908. -- Toggle button for auto gift
  2909. local autoGiftToggle = Instance.new("TextButton")
  2910. autoGiftToggle.Name = "AutoGiftToggle"
  2911. autoGiftToggle.Size = UDim2.new(0.3, 0, 0, 25)
  2912. autoGiftToggle.Position = UDim2.new(0.65, 0, 0, 180)
  2913. autoGiftToggle.BackgroundColor3 = Color3.fromRGB(60, 60, 85)
  2914. autoGiftToggle.BorderSizePixel = 0
  2915. autoGiftToggle.Text = "OFF"
  2916. autoGiftToggle.TextColor3 = Color3.fromRGB(255, 255, 255)
  2917. autoGiftToggle.Font = Enum.Font.GothamBold
  2918. autoGiftToggle.TextSize = 14
  2919. autoGiftToggle.Parent = giftFrame
  2920.  
  2921. -- Toggle button corner radius
  2922. local toggleCorner = Instance.new("UICorner")
  2923. toggleCorner.CornerRadius = UDim.new(0, 6)
  2924. toggleCorner.Parent = autoGiftToggle
  2925.  
  2926. -- Buttons row
  2927. local setButton = Instance.new("TextButton")
  2928. setButton.Name = "SetButton"
  2929. setButton.Size = UDim2.new(0.45, 0, 0, 30)
  2930. setButton.Position = UDim2.new(0.05, 0, 0, 215)
  2931. setButton.BackgroundColor3 = Color3.fromRGB(80, 170, 100)
  2932. setButton.BorderSizePixel = 0
  2933. setButton.Text = "Set Values"
  2934. setButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  2935. setButton.Font = Enum.Font.GothamBold
  2936. setButton.TextSize = 14
  2937. setButton.Parent = giftFrame
  2938.  
  2939. -- Button corner radius
  2940. local setCorner = Instance.new("UICorner")
  2941. setCorner.CornerRadius = UDim.new(0, 6)
  2942. setCorner.Parent = setButton
  2943.  
  2944. local giftButton = Instance.new("TextButton")
  2945. giftButton.Name = "GiftButton"
  2946. giftButton.Size = UDim2.new(0.45, 0, 0, 30)
  2947. giftButton.Position = UDim2.new(0.5, 0, 0, 215)
  2948. giftButton.BackgroundColor3 = Color3.fromRGB(130, 80, 170)
  2949. giftButton.BorderSizePixel = 0
  2950. giftButton.Text = "Send Gift"
  2951. giftButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  2952. giftButton.Font = Enum.Font.GothamBold
  2953. giftButton.TextSize = 14
  2954. giftButton.Parent = giftFrame
  2955.  
  2956. -- Button corner radius
  2957. local giftCorner = Instance.new("UICorner")
  2958. giftCorner.CornerRadius = UDim.new(0, 6)
  2959. giftCorner.Parent = giftButton
  2960.  
  2961. -- Make GUI draggable
  2962. local dragging = false
  2963. local dragInput
  2964. local dragStart
  2965. local startPos
  2966.  
  2967. titleBar.InputBegan:Connect(function(input)
  2968.     if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  2969.         dragging = true
  2970.         dragStart = input.Position
  2971.         startPos = giftFrame.Position
  2972.        
  2973.         input.Changed:Connect(function()
  2974.             if input.UserInputState == Enum.UserInputState.End then
  2975.                 dragging = false
  2976.             end
  2977.         end)
  2978.     end
  2979. end)
  2980.  
  2981. titleBar.InputChanged:Connect(function(input)
  2982.     if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  2983.         dragInput = input
  2984.     end
  2985. end)
  2986.  
  2987. game:GetService("UserInputService").InputChanged:Connect(function(input)
  2988.     if input == dragInput and dragging then
  2989.         local delta = input.Position - dragStart
  2990.         giftFrame.Position = UDim2.new(
  2991.             startPos.X.Scale,
  2992.             startPos.X.Offset + delta.X,
  2993.             startPos.Y.Scale,
  2994.             startPos.Y.Offset + delta.Y
  2995.         )
  2996.     end
  2997. end)
  2998.  
  2999. -- Wait for acceptance toggle functionality
  3000. waitAcceptToggle.MouseButton1Click:Connect(function()
  3001.     WAIT_FOR_GIFT_ACCEPTANCE = not WAIT_FOR_GIFT_ACCEPTANCE
  3002.    
  3003.     if WAIT_FOR_GIFT_ACCEPTANCE then
  3004.         waitAcceptToggle.Text = "ON"
  3005.         waitAcceptToggle.BackgroundColor3 = Color3.fromRGB(80, 170, 100) -- Green
  3006.     else
  3007.         waitAcceptToggle.Text = "OFF"
  3008.         waitAcceptToggle.BackgroundColor3 = Color3.fromRGB(60, 60, 85) -- Default
  3009.     end
  3010. end)
  3011.  
  3012. -- Auto gift toggle functionality
  3013. autoGiftToggle.MouseButton1Click:Connect(function()
  3014.     isAutoGiftEnabled = not isAutoGiftEnabled
  3015.    
  3016.     if isAutoGiftEnabled then
  3017.         autoGiftToggle.Text = "ON"
  3018.         autoGiftToggle.BackgroundColor3 = Color3.fromRGB(80, 170, 100) -- Green
  3019.        
  3020.         -- Start auto gift thread
  3021.         if not autoGiftThread then
  3022.             autoGiftThread = spawn(function()
  3023.                 while isAutoGiftEnabled do
  3024.                     -- Only gift if the button is not already in "Gifting..." state
  3025.                     if giftButton.Text == "Send Gift" then
  3026.                         GiftFruitToNearestPlayer()
  3027.                     end
  3028.                    
  3029.                     -- Wait until gifting is complete
  3030.                     while giftButton.Text == "Gifting..." and isAutoGiftEnabled do
  3031.                         task.wait(1)
  3032.                     end
  3033.                    
  3034.                     -- Wait between gift attempts
  3035.                     task.wait(5)
  3036.                 end
  3037.                
  3038.                 autoGiftThread = nil
  3039.             end)
  3040.         end
  3041.     else
  3042.         autoGiftToggle.Text = "OFF"
  3043.         autoGiftToggle.BackgroundColor3 = Color3.fromRGB(60, 60, 85) -- Default
  3044.        
  3045.         -- Stop auto gift thread
  3046.         if autoGiftThread then
  3047.             task.cancel(autoGiftThread)
  3048.             autoGiftThread = nil
  3049.         end
  3050.     end
  3051. end)
  3052.  
  3053. -- Set button functionality
  3054. setButton.MouseButton1Click:Connect(function()
  3055.     -- Update Gift Amount value
  3056.     local giftAmount = tonumber(giftAmountInput.Text)
  3057.     if giftAmount and giftAmount > 0 and giftAmount <= 1000 then
  3058.         GIFT_FRUIT_AMOUNT = giftAmount
  3059.     else
  3060.         giftAmountInput.Text = tostring(GIFT_FRUIT_AMOUNT)
  3061.     end
  3062.    
  3063.     -- Update Min Price value (convert from billions to actual value)
  3064.     local minPriceValue = tonumber(minPriceInput.Text)
  3065.     if minPriceValue and minPriceValue > 0 then
  3066.         MIN_FRUIT_VALUE_TO_GIFT = minPriceValue * 1e9  -- Convert billions to actual value
  3067.     else
  3068.         minPriceInput.Text = tostring(MIN_FRUIT_VALUE_TO_GIFT / 1e9)
  3069.     end
  3070.    
  3071.     -- Update Max Price value (convert from billions to actual value)
  3072.     local maxPriceValue = tonumber(maxPriceInput.Text)
  3073.     if maxPriceValue and maxPriceValue > minPriceValue then
  3074.         MAX_FRUIT_VALUE_TO_GIFT = maxPriceValue * 1e9  -- Convert billions to actual value
  3075.     else
  3076.         maxPriceInput.Text = tostring(MAX_FRUIT_VALUE_TO_GIFT / 1e9)
  3077.     end
  3078.    
  3079.     -- Update GUI
  3080.     giftAmountInput.Text = tostring(GIFT_FRUIT_AMOUNT)
  3081.     minPriceInput.Text = tostring(MIN_FRUIT_VALUE_TO_GIFT / 1e9)
  3082.     maxPriceInput.Text = tostring(MAX_FRUIT_VALUE_TO_GIFT / 1e9)
  3083.    
  3084.     -- Notification
  3085.     print("Values set: Gift Amount = " .. GIFT_FRUIT_AMOUNT ..
  3086.           ", Min Price = " .. formatNumber(MIN_FRUIT_VALUE_TO_GIFT) ..
  3087.           ", Max Price = " .. formatNumber(MAX_FRUIT_VALUE_TO_GIFT))
  3088. end)
  3089.  
  3090. -- Gift button functionality
  3091. giftButton.MouseButton1Click:Connect(function()
  3092.     GiftFruitToNearestPlayer()
  3093. end)
  3094.  
  3095. -- Function to gift fruits to nearest player
  3096. function GiftFruitToNearestPlayer()
  3097.     -- Prevent multiple runs
  3098.     if giftButton.Text ~= "Send Gift" then return end
  3099.    
  3100.     -- Update button state
  3101.     giftButton.Text = "Gifting..."
  3102.     giftButton.BackgroundColor3 = Color3.fromRGB(100, 50, 130)
  3103.    
  3104.     spawn(function()
  3105.         pcall(function()
  3106.             -- Find the nearest player
  3107.             local nearestPlayer = nil
  3108.             local shortestDistance = math.huge
  3109.             local character = player.Character
  3110.            
  3111.             if not character then
  3112.                 print("Character not found!")
  3113.                 giftButton.Text = "Send Gift"
  3114.                 giftButton.BackgroundColor3 = Color3.fromRGB(130, 80, 170)
  3115.                 return
  3116.             end
  3117.            
  3118.             local rootPart = character:FindFirstChild("HumanoidRootPart")
  3119.             if not rootPart then
  3120.                 print("HumanoidRootPart not found!")
  3121.                 giftButton.Text = "Send Gift"
  3122.                 giftButton.BackgroundColor3 = Color3.fromRGB(130, 80, 170)
  3123.                 return
  3124.             end
  3125.            
  3126.             for _, otherPlayer in pairs(Players:GetPlayers()) do
  3127.                 if otherPlayer ~= player and otherPlayer.Character then
  3128.                     local otherRootPart = otherPlayer.Character:FindFirstChild("HumanoidRootPart")
  3129.                     if otherRootPart then
  3130.                         local distance = (rootPart.Position - otherRootPart.Position).Magnitude
  3131.                         if distance < shortestDistance then
  3132.                             shortestDistance = distance
  3133.                             nearestPlayer = otherPlayer
  3134.                         end
  3135.                     end
  3136.                 end
  3137.             end
  3138.            
  3139.             if not nearestPlayer then
  3140.                 print("No players found nearby to gift to!")
  3141.                 giftButton.Text = "Send Gift"
  3142.                 giftButton.BackgroundColor3 = Color3.fromRGB(130, 80, 170)
  3143.                 return
  3144.             end
  3145.            
  3146.             print("Gifting to nearest player: " .. nearestPlayer.Name)
  3147.            
  3148.             -- Get player data
  3149.             local DataService = require(ReplicatedStorage.Modules.DataService)
  3150.             local playerData = DataService:GetData()
  3151.            
  3152.             if not playerData or not playerData.InventoryData then
  3153.                 print("Player data not found!")
  3154.                 giftButton.Text = "Send Gift"
  3155.                 giftButton.BackgroundColor3 = Color3.fromRGB(130, 80, 170)
  3156.                 return
  3157.             end
  3158.            
  3159.             -- Find fruits within value range
  3160.             local validFruits = {}
  3161.             for uuid, itemData in pairs(playerData.InventoryData) do
  3162.                 if itemData.ItemType == "Holdable" and itemData.ItemData then
  3163.                     -- Find the tool
  3164.                     local tool = nil
  3165.                     for _, t in pairs(player.Backpack:GetChildren()) do
  3166.                         if t:IsA("Tool") and t:GetAttribute("ITEM_UUID") == uuid then
  3167.                             tool = t
  3168.                             break
  3169.                         end
  3170.                     end
  3171.                    
  3172.                     -- If tool is found, calculate its value
  3173.                     if tool and tool:GetAttribute("ItemType") ~= "Pet" then
  3174.                         -- Calculate the item's value
  3175.                         local itemValue = CalculatePlantValue(tool)
  3176.                        
  3177.                         -- Add to the list if within value range
  3178.                         if itemValue >= MIN_FRUIT_VALUE_TO_GIFT and itemValue <= MAX_FRUIT_VALUE_TO_GIFT then
  3179.                             table.insert(validFruits, {
  3180.                                 tool = tool,
  3181.                                 value = itemValue,
  3182.                                 uuid = uuid,
  3183.                                 isFavorite = itemData.ItemData.IsFavorite or false
  3184.                             })
  3185.                         end
  3186.                     end
  3187.                 end
  3188.             end
  3189.            
  3190.             -- Sort by value (highest first)
  3191.             table.sort(validFruits, function(a, b)
  3192.                 return a.value > b.value
  3193.             end)
  3194.            
  3195.             -- Gift each fruit one by one (make sure they have different UUIDs)
  3196.             local giftsToSend = {}
  3197.             local uniqueUUIDs = {}
  3198.            
  3199.             -- Filter for unique UUIDs
  3200.             for _, fruitData in ipairs(validFruits) do
  3201.                 if not uniqueUUIDs[fruitData.uuid] then
  3202.                     uniqueUUIDs[fruitData.uuid] = true
  3203.                     table.insert(giftsToSend, fruitData)
  3204.                    
  3205.                     if #giftsToSend >= GIFT_FRUIT_AMOUNT then
  3206.                         break
  3207.                     end
  3208.                 end
  3209.             end
  3210.            
  3211.             if #giftsToSend == 0 then
  3212.                 print("No fruits found within value range to gift!")
  3213.                 giftButton.Text = "Send Gift"
  3214.                 giftButton.BackgroundColor3 = Color3.fromRGB(130, 80, 170)
  3215.                 return
  3216.             end
  3217.            
  3218.             -- Gift each fruit one by one
  3219.             print("Gifting " .. #giftsToSend .. " fruits...")
  3220.             local giftsCompleted = 0
  3221.            
  3222.             for i, fruitData in ipairs(giftsToSend) do
  3223.                 -- Unequip any current tool
  3224.                 for _, tool in pairs(character:GetChildren()) do
  3225.                     if tool:IsA("Tool") then
  3226.                         tool.Parent = player.Backpack
  3227.                     end
  3228.                 end
  3229.                 task.wait(0.5)
  3230.                
  3231.                 -- Equip the fruit
  3232.                 local favoriteStatus = fruitData.isFavorite and " [⭐]" or ""
  3233.                 print("Gifting #" .. i .. ": " .. fruitData.tool.Name .. favoriteStatus ..
  3234.                      " - Value: " .. formatNumber(fruitData.value))
  3235.                 fruitData.tool.Parent = character
  3236.                 task.wait(0.5) -- Wait longer after equipping
  3237.                
  3238.                 -- Find and trigger proximity prompts on target player
  3239.                 local giftSuccess = false
  3240.                 if nearestPlayer.Character then
  3241.                     local targetHRP = nearestPlayer.Character:FindFirstChild("HumanoidRootPart")
  3242.                     if targetHRP then
  3243.                         for _, obj in pairs(targetHRP:GetChildren()) do
  3244.                             if obj:IsA("ProximityPrompt") and obj.Enabled then
  3245.                                 -- Trigger the proximity prompt
  3246.                                 fireproximityprompt(obj)
  3247.                                
  3248.                                 -- If waiting for acceptance is enabled, actively wait until item is gone
  3249.                                 if WAIT_FOR_GIFT_ACCEPTANCE then
  3250.                                     local waitStartTime = tick()
  3251.                                     local maxWaitTime = 15 -- Maximum wait time in seconds
  3252.                                    
  3253.                                     -- Update status in GUI
  3254.                                     giftButton.Text = "Waiting..."
  3255.                                    
  3256.                                     -- Wait loop - check every 1 second if tool is gone
  3257.                                     while tick() - waitStartTime < maxWaitTime do
  3258.                                         -- Check if tool is gone (gift succeeded)
  3259.                                         if not fruitData.tool:IsDescendantOf(game) then
  3260.                                             print("Successfully gifted: " .. fruitData.tool.Name)
  3261.                                             giftSuccess = true
  3262.                                             giftsCompleted = giftsCompleted + 1
  3263.                                             break
  3264.                                         end
  3265.                                        
  3266.                                         -- Short wait between checks
  3267.                                         task.wait(1)
  3268.                                     end
  3269.                                    
  3270.                                     -- Update status back
  3271.                                     giftButton.Text = "Gifting..."
  3272.                                 else
  3273.                                     -- Fixed wait time from the original working code
  3274.                                     task.wait(1)
  3275.                                    
  3276.                                     -- Check if tool is gone (gift succeeded)
  3277.                                     if not fruitData.tool:IsDescendantOf(game) then
  3278.                                         print("Successfully gifted: " .. fruitData.tool.Name)
  3279.                                         giftSuccess = true
  3280.                                         giftsCompleted = giftsCompleted + 1
  3281.                                     end
  3282.                                 end
  3283.                                
  3284.                                 if giftSuccess then break end
  3285.                             end
  3286.                         end
  3287.                     end
  3288.                 end
  3289.                
  3290.                 -- Return to backpack if still in character and gift failed
  3291.                 if not giftSuccess and character:FindFirstChild(fruitData.tool.Name) then
  3292.                     print("Failed to gift: " .. fruitData.tool.Name)
  3293.                     fruitData.tool.Parent = player.Backpack
  3294.                 end
  3295.                
  3296.                 task.wait(0.3)
  3297.             end
  3298.            
  3299.             print("Gifting complete! Successfully gifted " .. giftsCompleted ..
  3300.                   " out of " .. #giftsToSend .. " fruits.")
  3301.         end)
  3302.        
  3303.         -- Ensure button is reset in case of error
  3304.         giftButton.Text = "Send Gift"
  3305.         giftButton.BackgroundColor3 = Color3.fromRGB(130, 80, 170)
  3306.     end)
  3307. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement