Advertisement
suramraja1

Dodo

Apr 29th, 2025
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 170.21 KB | None | 0 0
  1. --BGSI New
  2.  
  3.  
  4. if not game:IsLoaded() then
  5.     game.Loaded:wait()
  6. end
  7.  
  8. task.wait(10)
  9.  
  10. --[[setfpscap(55)
  11. print("FPS CAP 15")]]--
  12.  
  13. -- Run a single check for 100M Egg availability
  14. spawn(function()
  15.     local success, result = pcall(function()
  16.         -- Wait a bit to ensure the game is fully loaded
  17.         task.wait(60)
  18.        
  19.         -- Check if the Generic folder exists
  20.         if workspace:FindFirstChild("Rendered") and workspace.Rendered:FindFirstChild("Generic") then
  21.             -- Check if 100M Egg exists directly
  22.             if workspace.Rendered.Generic:FindFirstChild("100M Egg") then
  23.                 return true -- Egg found
  24.             else
  25.                 -- Iterate through all children of Generic to find 100M Egg
  26.                 for i, v in pairs(workspace.Rendered.Generic:GetChildren()) do
  27.                     if v.Name == "100M Egg" then
  28.                         return true -- Egg found
  29.                     end
  30.                 end
  31.             end
  32.         end
  33.        
  34.         -- If we reach here, egg was not found
  35.         game:GetService("Players").LocalPlayer:Kick("100M Egg not available in this server. Please rejoin a different server.")
  36.         return false
  37.     end)
  38.    
  39.     if not success then
  40.         print("Error checking for 100M Egg: " .. tostring(result))
  41.     end
  42. end)
  43.  
  44. spawn(function() -- anti afk
  45.     task.wait(30)
  46.  
  47.     local vu = game:GetService("VirtualUser")
  48.     game:GetService("Players").LocalPlayer.Idled:connect(function()
  49.         vu:Button2Down(Vector2.new(0,0),workspace.CurrentCamera.CFrame)
  50.         wait(1)
  51.         vu:Button2Up(Vector2.new(0,0),workspace.CurrentCamera.CFrame)
  52.     end)
  53. end)
  54.  
  55. spawn(function() -- remove hatach animation
  56.     task.wait(30)
  57.    
  58.     local HatchEggModule = nil
  59.  
  60.     for _, func in next, getgc(true) do
  61.         if typeof(func) == "function" and getfenv(func).script then
  62.             local scriptName = getfenv(func).script.Name
  63.             local scriptParent = getfenv(func).script.Parent
  64.  
  65.             -- Look for the right module
  66.             if scriptName == "HatchEgg" and tostring(scriptParent) == "Effects" then
  67.                 local env = getfenv(func)
  68.                 local module = require(env.script)
  69.  
  70.                 if typeof(module) == "table" then
  71.                     HatchEggModule = module
  72.                     break
  73.                 end
  74.             end
  75.         end
  76.     end
  77.  
  78.     -- Disable all functions in the HatchEgg module
  79.     if HatchEggModule then
  80.         for key, value in pairs(HatchEggModule) do
  81.             if typeof(value) == "function" then
  82.                 HatchEggModule[key] = function(...) return end
  83.             end
  84.         end
  85.         print("โœ… Hatch animation functions disabled.")
  86.     else
  87.         warn("โŒ Failed to find HatchEgg module.")
  88.     end
  89. end)
  90.  
  91. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Local Stuff โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  92.  
  93. local GuiService            = game:GetService("GuiService")
  94. local VIM                   = game:GetService("VirtualInputManager")
  95. local TweenService          = game:GetService("TweenService")
  96. local Players               = game:GetService("Players")
  97. local HttpService           = game:GetService("HttpService")
  98. local Remote                = game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote
  99. local LocalDataService      = require(game:GetService("ReplicatedStorage").Client.Framework.Services.LocalData)
  100. local data                  = LocalDataService:Get()
  101.  
  102. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Auto Trade Secret Pets โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  103.  
  104. local AutoTradeSecretPets_Toggle = false
  105. local tradeThread = nil
  106. local targetTradeName = "PixyPalx" -- Target player name (can be easily changed)
  107.  
  108. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Auto Bubble & Sell Function โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  109.  
  110. local Auto_Bubble_And_Sell_Active = false
  111. local Auto_Bubble_And_Sell_Thread = nil
  112.  
  113. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Auto Use Potion Settings โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  114.  
  115. local isAutoUsingPotions = false
  116. local autoUsingPotionsThread = nil
  117. local isHatchingX25Egg = false  -- New flag to track if we're hatching a x25 egg
  118.  
  119. -- List of regular potions we want to maintain active all the time
  120. local priorityPotions = {
  121.     "Lucky",
  122.     "Speed",
  123.     "Mythic"
  124. }
  125.  
  126. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Auto Collect Pickup Settings โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  127.  
  128. local isAutoCollectingPickups = false
  129. local autoCollectingPickupsThread = nil
  130.  
  131. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Auto Hatch Settings โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  132.  
  133. local isAutoHatching = false
  134. local autoHatchingThread = nil
  135. local tempDisableHatching = false
  136. local pickupCollectionStartedByHatcher = false -- Track if we started pickup collection
  137.  
  138. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Coin & Gems Settings โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  139.  
  140. local Max_Coins =   400000000000 --400B
  141. local Low_Coins =   100000000 --100M
  142.  
  143. local Max_Gems  =   100000000 --100M
  144. local Low_Gems  =   10000000 --10M
  145.  
  146. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Enchant Settings โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  147. -- ๐Ÿ”ง CONFIG: Desired Enchants and Level
  148. local enchants = {
  149.     ["team-up"] = 5
  150. }
  151. -- ๐Ÿงช You can add more like:
  152. -- ["strong"]   = 2,
  153. -- ["bubbler"]  = 5,
  154. -- ["looter"]   = 5,
  155. -- ["gleaming"] = 5
  156.  
  157. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Area To Unlock โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  158. -- ๐Ÿ”ง CONFIG: Areas to Unlock
  159. local AreaToUnlock = {
  160.     "Floating Island",
  161.     "Outer Space",
  162.     "Twilight",
  163.     "The Void",
  164.     "Zen"
  165. }
  166.  
  167. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Auto Mastery โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  168.  
  169. local isAutoMastery = false -- Flag to track if we're automatically upgrading mastery
  170. local autoMasteryThread = nil -- Variable to store the auto mastery thread
  171.  
  172. local PetsMasteryCompleted = false  -- Flag to track if Pets mastery reached target
  173. local BuffsMasteryCompleted = false  -- Flag to track if Buffs mastery reached target
  174. local ShopsMasteryCompleted = false  -- Flag to track if Shops mastery reached target
  175. local AllMasteryCompleted = false  -- Flag to track if all mastery reached targets
  176.  
  177. local Target_Pets_Mastery = 15
  178. local Target_Buffs_Mastery = 17
  179. local Target_Shops_Mastery = 10
  180.  
  181. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Egg Counter โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  182.  
  183. -- Add these at the top with your other global variables
  184. local EggCounterGui = nil
  185. local isEggCounterEnabled = false
  186. local CurrentlyHatchingEgg = nil
  187.  
  188. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Secret Pet Settings โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  189.  
  190. -- Define list of secret pets
  191. local SecretPets = {
  192.     "Avernus",
  193.     "King Doggy",
  194.     "The Overlord",
  195.     "MAN FACE GOD",
  196.     "Royal Trophy",
  197.     "Giant Chocolate Chicken",
  198.     "Easter Basket",
  199.     "Dementor",
  200.     "Godly Gem"
  201.     -- Add more pet names here
  202. }
  203.  
  204. local SecretPetCheck_Toggle = false
  205. local SecretPetOverlay = nil
  206.  
  207. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Egg List & Priority โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  208.  
  209. local Default_Egg = CFrame.new(19, 2, -2)
  210.  
  211. -- Define egg mapping - workspace model name to actual egg name for remote call
  212. local eggMapping = {
  213.     ["common-egg"] = "Common Egg",
  214.     ["void-egg"] = "Void Egg",
  215.     --["nightmare-egg"] = "Nightmare Egg",
  216.     --["aura-egg"] = "Aura Egg",
  217.     --["event-3"] = "Throwback Egg",  -- Correct event egg name
  218.     ["silly-egg"] = "Silly Egg",
  219.     ["100M Egg"] = "100M Egg"
  220.  
  221. }
  222.  
  223. -- Prioritize eggs (higher index = higher priority)
  224. local eggPriority = {
  225.    -- "event-3", -- Highest priority
  226.     "silly-egg",
  227.    -- "aura-egg",
  228.     --"nightmare-egg",
  229.     "void-egg",
  230.     "common-egg", -- Lowest priority
  231.     "100M Egg"
  232. }
  233.  
  234. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Auto Craft Potion Settings โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  235.  
  236. -- Configuration
  237. local potionTypes = {
  238.     "Lucky",
  239.     "Speed",
  240.     "Mythic",
  241.     "Coins"
  242. }
  243.  
  244. -- Define crafting requirements for each tier
  245. local craftingRequirements = {
  246.     [2] = 4,  -- Level 2 requires 4x Level 1
  247.     [3] = 4,  -- Level 3 requires 4x Level 2
  248.     [4] = 6,  -- Level 4 requires 6x Level 3
  249.     [5] = 8   -- Level 5 requires 8x Level 4
  250. }
  251.  
  252.  
  253. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Pet List To Delete โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  254.  
  255. -- The threshold amount to keep for all pets in the list
  256. local petKeepThreshold = 1 --Normal pet type
  257. local shinyKeepThreshold = 5  --shiny pet type
  258.  
  259. -- List of pet names to delete when they exceed 10
  260. local petsToDelete = {
  261.     --Common Egg
  262.     "Doggy",
  263.     "Kitty",
  264.     "Bunny",
  265.     "Bear",
  266.     --Common Egg
  267.     "Mouse",
  268.     "Wolf",
  269.     "Fox",
  270.     "Polar Bear",
  271.     "Panda",
  272.     --Spotted Egg
  273.     "Ice Kitty",
  274.     "Deer",
  275.     "Ice Wolf",
  276.     "Piggy",
  277.     "Ice Deer",
  278.     "Ice Dragon",
  279.     --Spikey Egg
  280.     "Golem",
  281.     "Dinosaur",
  282.     "Ruby Golem",
  283.     "Dragon",
  284.     "Dark Dragon",
  285.     "Emerald Golem",
  286.     --Magma Egg
  287.     "Magma Doggy",
  288.     "Magma Deer",
  289.     "Magma Fox",
  290.     "Magma Bear",
  291.     "Demon",
  292.     "Inferno Dragon",
  293.     --Crystal Egg
  294.     "Cave Bat",
  295.     "Dark Bat",
  296.     "Angel",
  297.     "Emerald Bat",
  298.     "Unicorn",
  299.     "Flying Pig",
  300.     --Lunar Egg
  301.     "Space Mouse",
  302.     "Space Bull",
  303.     "Lunar Fox",
  304.     "Lunarcorn",
  305.     "Lunar Serpent",
  306.     "Electra",
  307.     --Void Egg
  308.     "Void Kitty",
  309.     "Void Bat",
  310.     "Void Demon",
  311.     "Dark Phoenix",
  312.     "Neon Elemental",
  313.     --Hell Egg
  314.     "Hell Piggy",
  315.     "Hell Dragon",
  316.     "Hell Crawler",
  317.     "Inferno Demon",
  318.     "Inferno Cube",
  319.     "Virus",
  320.     --Nightmare Egg
  321.     "Demon Doggy",
  322.     "Skeletal Deer",
  323.     "Night Crawler",
  324.     "Hell Bat",
  325.     "Green Hydra",
  326.     "Demonic Hydra",
  327.     --Rainbow Egg
  328.     "Red Golem",
  329.     "Orange Deer",
  330.     "Yellow Fox",
  331.     "Green Angel",
  332.     --Aura Egg
  333.     "Manny",
  334.     "Manicorn",
  335.     "Sigma Serpent",
  336.     "Manarium",
  337.     --Pastel Egg
  338.     "Paper Doggy",
  339.     "Paper Bunny",
  340.     "Chubby Bunny",
  341.     "Hatchling",
  342.     --Bunny Egg
  343.     "Bunny Doggy",
  344.     "Egg Bunny",
  345.     "Angel Bunny",
  346.     "Seraphic Bunny",
  347.     --Throwback Egg
  348.     "Bow Bunny",
  349.     "Easter Egg",
  350.     "Flying Bunny",
  351.     "Easter Serpent",
  352.     --100M Egg
  353.     "Bronze Bunny",
  354.     "Silver Fox",
  355.     "Golden Dragon",
  356.     "Diamond Serpent",
  357.     "Diamond Hexarium",
  358.     "King Pufferfish"
  359. }
  360.  
  361. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Flavors & Gum Settings โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  362.  
  363. -- Auto buy variables
  364. local AutoBuy_Toggle = false
  365. local Buy_Thread = nil
  366. local max_Flavor_Reached = false
  367. local max_Gum_Reached = false
  368. local max_Upgrades_Reached = false
  369.  
  370. -- ๐Ÿ”ง CONFIG: Flavors to Buy (sorted by price)
  371. local flavorsConfig = {
  372.     ["Blueberry"] = {
  373.         price = 25,
  374.         currency = "Coins"
  375.     },
  376.     ["Cherry"] = {
  377.         price = 500,
  378.         currency = "Coins"
  379.     },
  380.     ["Pizza"] = {
  381.         price = 1500,
  382.         currency = "Coins"
  383.     },
  384.     ["Watermelon"] = {
  385.         price = 3500,
  386.         currency = "Coins"
  387.     },
  388.     ["Chocolate"] = {
  389.         price = 10000,
  390.         currency = "Coins"
  391.     },
  392.     ["Contrast"] = {
  393.         price = 35000,
  394.         currency = "Coins"
  395.     },
  396.     ["Gold"] = {
  397.         price = 100000,
  398.         currency = "Coins"
  399.     },
  400.     ["Lemon"] = {
  401.         price = 450000,
  402.         currency = "Coins"
  403.     },
  404.     ["Donut"] = {
  405.         price = 1500000,
  406.         currency = "Coins"
  407.     },
  408.     ["Swirl"] = {
  409.         price = 30000000,
  410.         currency = "Coins"
  411.     },
  412.     ["Molten"] = {
  413.         price = 350000000,
  414.         currency = "Coins"
  415.     }
  416. }
  417.  
  418. -- ๐Ÿ”ง CONFIG: Gum to Buy (sorted by price)
  419. local gumConfig = {
  420.     ["Stretchy Gum"] = {
  421.         price = 25,
  422.         currency = "Coins"
  423.     },
  424.     ["Chewy Gum"] = {
  425.         price = 250,
  426.         currency = "Coins"
  427.     },
  428.     ["Epic Gum"] = {
  429.         price = 1500,
  430.         currency = "Coins"
  431.     },
  432.     ["Ultra Gum"] = {
  433.         price = 5000,
  434.         currency = "Coins"
  435.     },
  436.     ["Omega Gum"] = {
  437.         price = 12000,
  438.         currency = "Coins"
  439.     },
  440.     ["Unreal Gum"] = {
  441.         price = 45000,
  442.         currency = "Coins"
  443.     },
  444.     ["Cosmic Gum"] = {
  445.         price = 125000,
  446.         currency = "Coins"
  447.     },
  448.     ["XL Gum"] = {
  449.         price = 650000,
  450.         currency = "Coins"
  451.     },
  452.     ["Mega Gum"] = {
  453.         price = 1500000,
  454.         currency = "Coins"
  455.     },
  456.     ["Quantum Gum"] = {
  457.         price = 5000000000,
  458.         currency = "Coins"
  459.     },
  460.     ["Alien Gum"] = {
  461.         price = 35000000,
  462.         currency = "Coins"
  463.     },
  464.     ["Radioactive Gum"] = {
  465.         price = 150000000,
  466.         currency = "Coins"
  467.     },
  468.     ["Experiment #52"] = {
  469.         price = 1000000000,
  470.         currency = "Coins"
  471.     }
  472. }
  473.  
  474. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Helper โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  475.  
  476. local function GetCurrentCoins()
  477.     return LocalDataService:Get().Coins
  478. end
  479.  
  480. local function GetCurrentGems()
  481.     return LocalDataService:Get().Gems
  482. end
  483.  
  484. local function getPetById(data, id)
  485.     for _, pet in ipairs(data.Pets) do
  486.         if pet.Id == id then
  487.             return pet
  488.         end
  489.     end
  490. end
  491.  
  492. -- Function to format numbers with suffixes (K, M, B, T, etc.)
  493. local function FormatNumberCompact(num)
  494.     if num >= 1e18 then return string.format("%.1fQnt", num / 1e18)
  495.     elseif num >= 1e15 then return string.format("%.1fQ", num / 1e15)
  496.     elseif num >= 1e12 then return string.format("%.1fT", num / 1e12)
  497.     elseif num >= 1e9 then return string.format("%.1fB", num / 1e9)
  498.     elseif num >= 1e6 then return string.format("%.1fM", num / 1e6)
  499.     elseif num >= 1e3 then return string.format("%.1fK", num / 1e3)
  500.     else return tostring(num)
  501.     end
  502. end
  503.  
  504. local function extractNumbers(text)
  505.     -- Remove all HTML-like tags
  506.     local cleanText = text:gsub("<[^>]+>", "")
  507.    
  508.     -- Extract the text before and after the slash
  509.     local currentStr, maxStr = cleanText:match("([%d%,%.]+)%s*/%s*([%d%,%.]+)")
  510.    
  511.     if not currentStr or not maxStr then
  512.         return nil, nil
  513.     end
  514.    
  515.     -- Remove commas from the numbers
  516.     currentStr = currentStr:gsub(",", "")
  517.     maxStr = maxStr:gsub(",", "")
  518.    
  519.     -- Convert to numbers
  520.     return tonumber(currentStr), tonumber(maxStr)
  521. end
  522.  
  523. -- Function to convert price text to a number value
  524. local function convertPriceToNumber(priceText)
  525.     -- Remove commas and spaces
  526.     local cleanPrice = priceText:gsub(",", ""):gsub("%s+", "")
  527.    
  528.     -- Check for suffixes like K, M, B
  529.     local value = tonumber(cleanPrice:match("^%d+%.?%d*"))
  530.     if not value then return 999999999999 end -- Return a high value if can't parse
  531.    
  532.     -- Handle suffixes
  533.     if cleanPrice:match("[Kk]$") then
  534.         value = value * 1000
  535.     elseif cleanPrice:match("[Mm]$") then
  536.         value = value * 1000000
  537.     elseif cleanPrice:match("[Bb]$") then
  538.         value = value * 1000000000
  539.     end
  540.    
  541.     return value
  542. end
  543. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Function Tween โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  544.  
  545. -- Function to tween character to a target
  546. function TweenCharacterToTarget(targetPart)
  547.     -- Parameter validation
  548.     if not targetPart then
  549.         warn("Target part not provided!")
  550.         return
  551.     end
  552.    
  553.     -- Fixed speeds
  554.     local horizontalSpeed = 16
  555.     local verticalSpeed = math.huge
  556.    
  557.     -- Get Player and Character
  558.     local player = Players.LocalPlayer
  559.     local character = player.Character or player.CharacterAdded:Wait()
  560.     local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
  561.    
  562.     -- Calculate Target CFrames and Durations
  563.     local startCFrame = humanoidRootPart.CFrame
  564.     local targetPosition = targetPart.Position + Vector3.new(1, 5, 1)
  565.    
  566.     -- Create initial downward position (5 units below current position)
  567.     local downwardPosition = startCFrame.Position + Vector3.new(0, -20, 0)
  568.     local downwardCFrame = CFrame.new(downwardPosition) * (startCFrame - startCFrame.Position)
  569.    
  570.     -- Intermediate CFrame: Target X/Z, current Y, maintain character orientation
  571.     local intermediatePosition = Vector3.new(targetPosition.X, downwardPosition.Y, targetPosition.Z)
  572.     local intermediateCFrame = CFrame.new(intermediatePosition) * (startCFrame - startCFrame.Position)
  573.    
  574.     -- Final CFrame: Target X/Y/Z, maintain character orientation
  575.     local finalCFrame = CFrame.new(targetPosition) * (startCFrame - startCFrame.Position)
  576.    
  577.     -- Calculate Distances
  578.     local downwardDistance = math.abs(startCFrame.Position.Y - downwardPosition.Y)
  579.     local horizontalDistance = (Vector3.new(downwardPosition.X, 0, downwardPosition.Z) - Vector3.new(intermediatePosition.X, 0, intermediatePosition.Z)).Magnitude
  580.     local verticalDistance = math.abs(intermediatePosition.Y - targetPosition.Y)
  581.    
  582.     -- Calculate Durations based on speed
  583.     local downwardTime = downwardDistance / verticalSpeed
  584.     local horizontalTime = horizontalDistance / horizontalSpeed
  585.     local verticalTime = verticalDistance / verticalSpeed
  586.    
  587.     -- TweenInfo Configuration
  588.     local tweenInfoDownward = TweenInfo.new(downwardTime, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
  589.     local tweenInfoHorizontal = TweenInfo.new(horizontalTime, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
  590.     local tweenInfoVertical = TweenInfo.new(verticalTime, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
  591.    
  592.     -- Create Tweens
  593.     local downwardTween = TweenService:Create(humanoidRootPart, tweenInfoDownward, { CFrame = downwardCFrame })
  594.     local horizontalTween = TweenService:Create(humanoidRootPart, tweenInfoHorizontal, { CFrame = intermediateCFrame })
  595.     local verticalTween = TweenService:Create(humanoidRootPart, tweenInfoVertical, { CFrame = finalCFrame })
  596.    
  597.     -- Play Tweens Sequentially
  598.     downwardTween.Completed:Connect(function(playbackState)
  599.         if playbackState == Enum.PlaybackState.Completed then
  600.             horizontalTween:Play()
  601.         end
  602.     end)
  603.    
  604.     horizontalTween.Completed:Connect(function(playbackState)
  605.         if playbackState == Enum.PlaybackState.Completed then
  606.             verticalTween:Play()
  607.         end
  608.     end)
  609.    
  610.     -- Start the first tween
  611.     downwardTween:Play()
  612.    
  613.     -- Return tweens so they can be monitored or cancelled
  614.     return horizontalTween, verticalTween, downwardTween
  615. end
  616.  
  617. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Auto Trade Secret Pets โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  618.  
  619. local AutoTradeSecretPets_Toggle = false
  620. local tradeThread = nil
  621. local targetTradeName = "PixyPalx" -- Target player name (can be easily changed)
  622.  
  623. local function autoTradeSecretPets()
  624.     AutoTradeSecretPets_Toggle = not AutoTradeSecretPets_Toggle
  625.    
  626.     if AutoTradeSecretPets_Toggle then
  627.         tradeThread = spawn(function()
  628.             while AutoTradeSecretPets_Toggle do
  629.                 local targetPlayer = game:GetService("Players"):FindFirstChild(targetTradeName)
  630.                
  631.                 if not targetPlayer then
  632.                     -- Wait for player to join
  633.                     for i = 1, 300 do
  634.                         if not AutoTradeSecretPets_Toggle then break end
  635.                         if game:GetService("Players"):FindFirstChild(targetTradeName) then break end
  636.                         task.wait(1)
  637.                     end
  638.                     task.wait(1)
  639.                     continue
  640.                 end
  641.                
  642.                 -- Quick check if we have any secret pets
  643.                 local freshPetData = LocalDataService:Get()
  644.                 local hasSecretPets = false
  645.                
  646.                 if freshPetData and freshPetData.Pets then
  647.                     for _, pet in pairs(freshPetData.Pets) do
  648.                         for _, secretPetName in pairs(SecretPets) do
  649.                             if pet.Name == secretPetName then
  650.                                 hasSecretPets = true
  651.                                 break
  652.                             end
  653.                         end
  654.                         if hasSecretPets then break end
  655.                     end
  656.                 end
  657.                
  658.                 if not hasSecretPets then
  659.                     task.wait(30)
  660.                     continue
  661.                 end
  662.                
  663.                 -- Trading logic
  664.                 local tradingUI = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui.Trading
  665.                
  666.                 -- If not in trade, send requests
  667.                 if not (tradingUI and tradingUI.Visible) then
  668.                     while targetPlayer and targetPlayer.Parent ~= nil and AutoTradeSecretPets_Toggle do
  669.                         tradingUI = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui.Trading
  670.                         if tradingUI and tradingUI.Visible then break end
  671.                        
  672.                         game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("TradeRequest", targetPlayer)
  673.                         task.wait(3)
  674.                     end
  675.                 end
  676.                
  677.                 -- Handle active trade
  678.                 tradingUI = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui.Trading
  679.                 if tradingUI and tradingUI.Visible then
  680.                     -- Verify trading with correct player
  681.                     local tradePartnerName = tradingUI.Frame.Top.Them.Username.Text
  682.                     if string.sub(tradePartnerName, 1, 1) == "@" then
  683.                         tradePartnerName = string.sub(tradePartnerName, 2)
  684.                     end
  685.                    
  686.                     if tradePartnerName == targetTradeName then
  687.                         -- Add pets to trade one by one, checking data each time
  688.                         local allPetsAdded = false
  689.                         local petCount = 0
  690.                        
  691.                         while not allPetsAdded and petCount < 10 do
  692.                             -- Get fresh pet data
  693.                             local currentPetData = LocalDataService:Get()
  694.                            
  695.                             -- Get currently traded pets and count them
  696.                             local tradeContent = tradingUI.Frame.Inner.Offers.You.Content
  697.                             local petIDsInTrade = {}
  698.                             petCount = 0
  699.                            
  700.                             for _, item in pairs(tradeContent:GetChildren()) do
  701.                                 if item:IsA("Frame") and not string.match(item.Name, "^Blank%d+$") and not string.match(item.Name, "^Entry%d+$") then
  702.                                     petIDsInTrade[item.Name] = true
  703.                                     petCount = petCount + 1
  704.                                 end
  705.                             end
  706.                            
  707.                             -- Stop if we've already added 10 pets
  708.                             if petCount >= 10 then
  709.                                 allPetsAdded = true
  710.                                 break
  711.                             end
  712.                            
  713.                             -- Try to find a pet to add
  714.                             local foundPetToAdd = false
  715.                             local petIdToAdd = nil
  716.                            
  717.                             if currentPetData and currentPetData.Pets then
  718.                                 for _, pet in pairs(currentPetData.Pets) do
  719.                                     -- Check if this pet is a secret pet
  720.                                     local isSecretPet = false
  721.                                     for _, secretPetName in pairs(SecretPets) do
  722.                                         if pet.Name == secretPetName then
  723.                                             isSecretPet = true
  724.                                             break
  725.                                         end
  726.                                     end
  727.                                    
  728.                                     if isSecretPet then
  729.                                         if pet.Amount then
  730.                                             -- For pets with Amount, add each index starting from 1
  731.                                             for i = 1, pet.Amount do
  732.                                                 local fullPetId = pet.Id .. ":" .. i
  733.                                                 if not petIDsInTrade[fullPetId] then
  734.                                                     petIdToAdd = fullPetId
  735.                                                     foundPetToAdd = true
  736.                                                     break
  737.                                                 end
  738.                                             end
  739.                                         else
  740.                                             -- For pets without Amount, just add :0
  741.                                             local fullPetId = pet.Id .. ":0"
  742.                                             if not petIDsInTrade[fullPetId] then
  743.                                                 petIdToAdd = fullPetId
  744.                                                 foundPetToAdd = true
  745.                                             end
  746.                                         end
  747.                                        
  748.                                         -- Check if we found a pet to add
  749.                                         if foundPetToAdd then
  750.                                             break
  751.                                         end
  752.                                     end
  753.                                 end
  754.                             end
  755.                            
  756.                             -- Add the pet if we found one
  757.                             if foundPetToAdd and petIdToAdd then
  758.                                 -- Before pet count
  759.                                 local beforeCount = petCount
  760.                                
  761.                                 -- Add the pet
  762.                                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("TradeAddPet", petIdToAdd)
  763.                                 task.wait(1) -- Wait a bit longer to ensure UI updates
  764.                                
  765.                                 -- Verify the pet was actually added by checking the count again
  766.                                 local tradeContent = tradingUI.Frame.Inner.Offers.You.Content
  767.                                 local afterCount = 0
  768.                                
  769.                                 for _, item in pairs(tradeContent:GetChildren()) do
  770.                                     if item:IsA("Frame") and not string.match(item.Name, "^Blank%d+$") and not string.match(item.Name, "^Entry%d+$") then
  771.                                         afterCount = afterCount + 1
  772.                                     end
  773.                                 end
  774.                                
  775.                                 -- Update pet count with current number in trade
  776.                                 petCount = afterCount
  777.                                
  778.                                 -- If count didn't increase, try one more time
  779.                                 if afterCount <= beforeCount then
  780.                                     task.wait(0.5)
  781.                                     game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("TradeAddPet", petIdToAdd)
  782.                                     task.wait(1)
  783.                                 end
  784.                             else
  785.                                 -- No more pets to add
  786.                                 allPetsAdded = true
  787.                             end
  788.                         end
  789.                        
  790.                         -- Double check how many pets we have in trade
  791.                         local finalTradeContent = tradingUI.Frame.Inner.Offers.You.Content
  792.                         local finalPetCount = 0
  793.                        
  794.                         for _, item in pairs(finalTradeContent:GetChildren()) do
  795.                             if item:IsA("Frame") and not string.match(item.Name, "^Blank%d+$") and not string.match(item.Name, "^Entry%d+$") then
  796.                                 finalPetCount = finalPetCount + 1
  797.                             end
  798.                         end
  799.                        
  800.                         -- Only proceed if we actually added some pets
  801.                         if finalPetCount > 0 then
  802.                             -- Accept trade after all pets added
  803.                             task.wait(1)
  804.                             game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("TradeAccept")
  805.                            
  806.                             task.wait(1)
  807.                             -- Check button text
  808.                             local acceptButtonText = tradingUI.Frame.Inner.Offers.Buttons.Accept.Button.Label.Text
  809.                            
  810.                             if acceptButtonText == "Confirm" then
  811.                                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("TradeConfirm")
  812.                             end
  813.                            
  814.                             task.wait(5)
  815.                         end
  816.                     end
  817.                 end
  818.                
  819.                 task.wait(1)
  820.             end
  821.         end)
  822.     else
  823.         if tradeThread then
  824.             task.cancel(tradeThread)
  825.             tradeThread = nil
  826.         end
  827.     end
  828.    
  829.     return AutoTradeSecretPets_Toggle
  830. end
  831.  
  832. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Secret Check โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  833.  
  834. -- Function to check if user has any secret pets
  835. local function checkForSecretPets()
  836.     -- Get fresh player data each time
  837.     local freshPetData = LocalDataService:Get()
  838.     local foundSecretPet = false
  839.     local secretPetCounts = {}
  840.     local playerName = game:GetService("Players").LocalPlayer.Name
  841.    
  842.     -- If data exists and has pets
  843.     if freshPetData and freshPetData.Pets then
  844.         -- Loop through all pets
  845.         for _, pet in pairs(freshPetData.Pets) do
  846.             -- Check if current pet name is in the secret pets list
  847.             for _, secretPetName in pairs(SecretPets) do
  848.                 if pet.Name == secretPetName then
  849.                     -- Count the pet
  850.                     secretPetCounts[secretPetName] = (secretPetCounts[secretPetName] or 0) + 1
  851.                     foundSecretPet = true
  852.                 end
  853.             end
  854.         end
  855.     end
  856.    
  857.     -- If any secret pets found, create or update the overlay
  858.     if foundSecretPet then
  859.         -- Create green overlay if it doesn't exist
  860.         if not SecretPetOverlay then
  861.             SecretPetOverlay = Instance.new("ScreenGui")
  862.             SecretPetOverlay.Name = "SecretPetOverlay"
  863.             SecretPetOverlay.ResetOnSpawn = false
  864.             SecretPetOverlay.IgnoreGuiInset = true
  865.             SecretPetOverlay.DisplayOrder = 99  -- Make it appear above egg counter
  866.            
  867.             -- Create fully green background
  868.             local frame = Instance.new("Frame")
  869.             frame.Size = UDim2.new(1, 0, 1, 0)
  870.             frame.BackgroundColor3 = Color3.fromRGB(0, 255, 0) -- Green
  871.             frame.BackgroundTransparency = 0
  872.             frame.BorderSizePixel = 0
  873.             frame.Name = "SecretFrame"
  874.             frame.Parent = SecretPetOverlay
  875.            
  876.             -- Add player name at the top
  877.             local playerNameLabel = Instance.new("TextLabel")
  878.             playerNameLabel.Size = UDim2.new(1, 0, 0, 60)
  879.             playerNameLabel.Position = UDim2.new(0, 0, 0.1, 0)
  880.             playerNameLabel.BackgroundTransparency = 1
  881.             playerNameLabel.Font = Enum.Font.SourceSansBold
  882.             playerNameLabel.TextSize = 140
  883.             playerNameLabel.TextWrapped = true
  884.             playerNameLabel.TextColor3 = Color3.fromRGB(255, 255, 255) -- White text
  885.             playerNameLabel.Text = "PLAYER: " .. string.upper(playerName)
  886.             playerNameLabel.TextStrokeTransparency = 0
  887.             playerNameLabel.TextStrokeColor3 = Color3.fromRGB(0, 0, 0)
  888.             playerNameLabel.Name = "PlayerName"
  889.             playerNameLabel.Parent = frame
  890.            
  891.             -- Add a ScrollingFrame to contain all pet text labels
  892.             local scrollFrame = Instance.new("ScrollingFrame")
  893.             scrollFrame.Size = UDim2.new(0.8, 0, 0.5, 0)
  894.             scrollFrame.Position = UDim2.new(0.1, 0, 0.25, 0)
  895.             scrollFrame.BackgroundTransparency = 1
  896.             scrollFrame.ScrollBarThickness = 6
  897.             scrollFrame.CanvasSize = UDim2.new(0, 0, 0, 0) -- Will be updated based on content
  898.             scrollFrame.Name = "PetList"
  899.             scrollFrame.Parent = frame
  900.            
  901.             SecretPetOverlay.Parent = game:GetService("CoreGui")
  902.         else
  903.             -- Update player name if it changed
  904.             SecretPetOverlay.SecretFrame.PlayerName.Text = "PLAYER: " .. string.upper(playerName)
  905.         end
  906.        
  907.         -- Get the scrolling frame reference
  908.         local scrollFrame = SecretPetOverlay.SecretFrame.PetList
  909.        
  910.         -- Clear existing pet labels
  911.         for _, child in pairs(scrollFrame:GetChildren()) do
  912.             if child:IsA("TextLabel") then
  913.                 child:Destroy()
  914.             end
  915.         end
  916.        
  917.         -- Add text labels for each secret pet with count
  918.         local yPosition = 0
  919.         for petName, count in pairs(secretPetCounts) do
  920.             local textLabel = Instance.new("TextLabel")
  921.             textLabel.Size = UDim2.new(1, 0, 0, 70)
  922.             textLabel.Position = UDim2.new(0, 0, 0, yPosition)
  923.             textLabel.BackgroundTransparency = 1
  924.             textLabel.Font = Enum.Font.SourceSansBold
  925.             textLabel.TextSize = 140
  926.             textLabel.TextWrapped = true
  927.             textLabel.TextColor3 = Color3.fromRGB(255, 255, 255) -- White text
  928.             textLabel.Text = string.upper(petName) .. " x" .. count
  929.             textLabel.TextStrokeTransparency = 0
  930.             textLabel.TextStrokeColor3 = Color3.fromRGB(0, 0, 0)
  931.             textLabel.Parent = scrollFrame
  932.            
  933.             yPosition = yPosition + 80
  934.         end
  935.        
  936.         -- Update canvas size to fit all labels
  937.         scrollFrame.CanvasSize = UDim2.new(0, 0, 0, yPosition)
  938.        
  939.         -- Enable auto trade if not already enabled
  940.         if not AutoTradeSecretPets_Toggle then
  941.             autoTradeSecretPets() -- Call the function to enable auto trading
  942.         end
  943.        
  944.         task.wait(5) -- Wait 5 seconds before the next check
  945.         return true
  946.     else
  947.         -- Remove overlay if no secret pets found
  948.         if SecretPetOverlay then
  949.             SecretPetOverlay:Destroy()
  950.             SecretPetOverlay = nil
  951.         end
  952.        
  953.         -- Disable auto trade if it's enabled
  954.         if AutoTradeSecretPets_Toggle then
  955.             autoTradeSecretPets() -- Call the function to disable auto trading
  956.         end
  957.        
  958.         task.wait(10) -- Wait 10 seconds before the next check
  959.         return false
  960.     end
  961. end
  962.  
  963. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Handle Intro โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  964.  
  965. local IntroHandling_Toggle = false
  966. local hasHandledIntro = false -- Flag to track if intro was successfully handled
  967.  
  968. local function SimulateIntroPlayButtonClick()
  969.     local IntroPlayButton = game:GetService("Players").LocalPlayer.PlayerGui.Intro.Play.Button
  970.     IntroPlayButton:SetAttribute("Pressed", true)
  971.     task.wait(0.1)
  972.     IntroPlayButton:SetAttribute("Pressed", false)
  973. end
  974.  
  975. local function SimulateOptimizedButtonClick()
  976.     local Optimized = game:GetService("Players").LocalPlayer.PlayerGui.Intro.Graphics.Content.Low.Action.Button
  977.     Optimized:SetAttribute("Pressed", true)
  978.     task.wait(0.1)
  979.     Optimized:SetAttribute("Pressed", false)
  980. end
  981.  
  982. local function handleIntro()
  983.     if IntroHandling_Toggle then
  984.         return hasHandledIntro
  985.     end
  986.    
  987.     IntroHandling_Toggle = true
  988.    
  989.     -- Keep trying until intro is completely gone - no timeout
  990.     while true do
  991.         -- Safely check if intro exists and is enabled
  992.         local success, introStillActive = pcall(function()
  993.             local Intro = game:GetService("Players").LocalPlayer.PlayerGui:FindFirstChild("Intro")
  994.            
  995.             if Intro and Intro.Enabled then
  996.                 -- Check if Play is visible and click it
  997.                 if Intro.Play.Visible == true then
  998.                     task.wait(5)
  999.                     SimulateIntroPlayButtonClick()
  1000.                     task.wait(1) -- Wait for graphics options to appear
  1001.                 end
  1002.                
  1003.                 -- Check if Graphics is visible and click low option
  1004.                 if Intro.Graphics.Visible == true then
  1005.                     SimulateOptimizedButtonClick()
  1006.                     task.wait(1)
  1007.                 end
  1008.                
  1009.                 -- Try clicking both again for good measure
  1010.                 SimulateIntroPlayButtonClick()
  1011.                 task.wait(0.5)
  1012.                 SimulateOptimizedButtonClick()
  1013.                
  1014.                 -- Intro still exists and is enabled
  1015.                 return true
  1016.             end
  1017.            
  1018.             -- Intro is gone or not enabled
  1019.             return false
  1020.         end)
  1021.        
  1022.         -- Check if intro is gone
  1023.         if success and not introStillActive then
  1024.             hasHandledIntro = true
  1025.             break
  1026.         end
  1027.        
  1028.         -- Wait a bit before checking again
  1029.         task.wait(2)
  1030.     end
  1031.    
  1032.     -- Turn off toggle when done
  1033.     IntroHandling_Toggle = false
  1034.    
  1035.     return hasHandledIntro
  1036. end
  1037.  
  1038. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Daily Rewards Function โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  1039.  
  1040. local CheckRewards_Toggle = false
  1041. local hasClaimedDailyReward = false -- Tracks if rewards were successfully claimed
  1042. local startCheckTime = nil
  1043.  
  1044. local function SimulateShopCloseButtonClick() -- for buying storage
  1045.     local ShopClose = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui.DailyRewards.Shop.Top.Close.Button
  1046.     ShopClose:SetAttribute("Pressed", true)
  1047.     task.wait(0.1)
  1048.     ShopClose:SetAttribute("Pressed", false)
  1049. end
  1050.  
  1051. local function checkDailyRewards()
  1052.     CheckRewards_Toggle = not CheckRewards_Toggle
  1053.    
  1054.     if CheckRewards_Toggle then
  1055.         -- Initialize timer on first check
  1056.         startCheckTime = os.time()
  1057.        
  1058.         -- Start thread or continue with logic
  1059.         spawn(function()
  1060.             while CheckRewards_Toggle do
  1061.                 -- Check if we've exceeded the timeout period (300 seconds / 5 minutes)
  1062.                 if os.time() - startCheckTime > 300 then
  1063.                     CheckRewards_Toggle = false -- Stop the function
  1064.                     return false
  1065.                 end
  1066.                
  1067.                 -- Use pcall for safety
  1068.                 local success, result = pcall(function()
  1069.                     -- Check if the daily rewards UI is visible
  1070.                     local dailyRewardsUI = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui.DailyRewards
  1071.                    
  1072.                     if dailyRewardsUI and dailyRewardsUI.Login and dailyRewardsUI.Login.Visible == true then
  1073.                         -- Claim the rewards
  1074.                         game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("DailyRewardClaimStars")
  1075.                         task.wait(1)
  1076.                        
  1077.                         -- Close the shop if it appeared
  1078.                         if dailyRewardsUI.Shop and dailyRewardsUI.Shop.Visible == true then
  1079.                             SimulateShopCloseButtonClick()
  1080.                             task.wait(0.5)
  1081.                         end
  1082.                        
  1083.                         -- Mark as successful and stop checking
  1084.                         CheckRewards_Toggle = false
  1085.                         hasClaimedDailyReward = true
  1086.                         return true
  1087.                     end
  1088.                    
  1089.                     -- Wait a bit before checking again
  1090.                     task.wait(1)
  1091.                     return false
  1092.                 end)
  1093.                
  1094.                 -- Handle errors
  1095.                 if not success then
  1096.                     CheckRewards_Toggle = false
  1097.                     return false
  1098.                 end
  1099.             end
  1100.         end)
  1101.     end
  1102.    
  1103.     return hasClaimedDailyReward
  1104. end
  1105.  
  1106. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Auto Claim Playtime โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  1107.  
  1108. local AutoClaimPlaytime_Toggle = false -- Flag to track if we're automatically claiming playtime rewards
  1109. local autoClaimingPlaytimeThread = nil -- Variable to store the auto claiming thread
  1110. local PlaytimeRewardsClaimed = false -- Flag to track if all playtime rewards are claimed
  1111.  
  1112. local function toggleAutoClaimPlaytime()
  1113.     -- If all rewards are claimed, don't start again
  1114.     if PlaytimeRewardsClaimed then
  1115.         return PlaytimeRewardsClaimed
  1116.     end
  1117.    
  1118.     AutoClaimPlaytime_Toggle = not AutoClaimPlaytime_Toggle
  1119.    
  1120.     if AutoClaimPlaytime_Toggle then
  1121.         -- Start a new thread for continuous playtime reward claiming
  1122.         autoClaimingPlaytimeThread = spawn(function()
  1123.             while AutoClaimPlaytime_Toggle do
  1124.                 -- Get the Playtime UI
  1125.                 local Playtime = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui.Playtime
  1126.                
  1127.                 -- Check if Playtime exists
  1128.                 if Playtime and Playtime:FindFirstChild("Frame") and Playtime.Frame:FindFirstChild("Main") then
  1129.                     local Main = Playtime.Frame.Main
  1130.                     local allClaimed = true -- Assume all claimed until we find one that's not
  1131.                     local foundAnyRewards = false -- Track if we found any reward UI elements
  1132.                     local anyPending = false -- Track if there are any pending rewards
  1133.                    
  1134.                     -- Loop through all children of Main
  1135.                     for _, child in pairs(Main:GetChildren()) do
  1136.                         -- Check if this is a numbered reward (1, 2, 3, 4, etc.)
  1137.                         if tonumber(child.Name) then
  1138.                             foundAnyRewards = true
  1139.                             local rewardNumber = tonumber(child.Name)
  1140.                             local button = child:FindFirstChild("Button")
  1141.                             local completed = child:FindFirstChild("Completed")
  1142.                            
  1143.                             -- Only proceed if both button and completed exist
  1144.                             if button and completed then
  1145.                                 local label = button:FindFirstChild("Label")
  1146.                                
  1147.                                 -- State 1: Ready to claim
  1148.                                 if label and label.Text == "Open" and not completed.Visible then
  1149.                                     allClaimed = false -- Found one that's not claimed
  1150.                                    
  1151.                                     -- Invoke server to claim the reward
  1152.                                     local success, result = pcall(function()
  1153.                                         return game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Function:InvokeServer("ClaimPlaytime", rewardNumber)
  1154.                                     end)
  1155.                                     game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("ClaimSeason")
  1156.                                     -- Wait a bit after claiming
  1157.                                     task.wait(1)
  1158.                                 end
  1159.                                
  1160.                                 -- State 2: Already claimed
  1161.                                 if completed.Visible and (not label or not label.Visible) then
  1162.                                     -- This one is already claimed, don't change allClaimed
  1163.                                 end
  1164.                                
  1165.                                 -- State 3: Pending (time countdown)
  1166.                                 if not completed.Visible and label and label.Text ~= "Open" then
  1167.                                     allClaimed = false -- Not all claimed yet
  1168.                                     anyPending = true -- We have pending rewards
  1169.                                 end
  1170.                             end
  1171.                         end
  1172.                     end
  1173.                    
  1174.                     -- If we found reward UI elements and all are claimed (none pending), we're done
  1175.                     if foundAnyRewards and allClaimed and not anyPending then
  1176.                         PlaytimeRewardsClaimed = true
  1177.                         AutoClaimPlaytime_Toggle = false
  1178.                         break
  1179.                     end
  1180.                 end
  1181.                
  1182.                 -- Wait before checking again
  1183.                 task.wait(30) -- Check for playtime rewards every 30 seconds
  1184.             end
  1185.         end)
  1186.     end
  1187.    
  1188.     return AutoClaimPlaytime_Toggle
  1189. end
  1190.  
  1191. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Auto Claim Prizes Function โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  1192.  
  1193. local AutoClaimPrizes_Toggle = false -- Flag to track if we're automatically claiming prizes
  1194. local autoClaimingPrizeThread = nil -- Variable to store the auto claiming thread
  1195.  
  1196. -- Function to check and claim available prizes once
  1197. local function CheckAndClaimPrizes()
  1198.     -- Get the Quests UI
  1199.     local Prizes = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui.Quests.Frame.Main.Prizes
  1200.    
  1201.     -- Loop through all prize items (b-1, b-2, etc.)
  1202.     for _, prizeItem in pairs(Prizes:GetChildren()) do
  1203.        
  1204.         -- Check for Content
  1205.         local Content = prizeItem:FindFirstChild("Content")
  1206.         if Content then
  1207.             -- Find Bar and Claim inside Content
  1208.             local Bar = Content:FindFirstChild("Bar")
  1209.             local Claim = Content:FindFirstChild("Claim")
  1210.            
  1211.             if Bar and Claim and Bar:FindFirstChild("Label") and Claim:FindFirstChild("Button") then
  1212.                 local progressText = Bar.Label.Text
  1213.                 local ClaimButton = Claim.Button
  1214.                
  1215.                 -- Check if progress is 100% and Claim is visible
  1216.                 if progressText == "100%" and Claim.Visible then
  1217.  
  1218.                     -- Simulate button press
  1219.                     ClaimButton:SetAttribute("Pressed", true)
  1220.                     task.wait(0.1)
  1221.                     ClaimButton:SetAttribute("Pressed", false)
  1222.                    
  1223.                     -- Return after claiming the first prize found
  1224.                     return true
  1225.                 end
  1226.             end
  1227.         end
  1228.     end
  1229.  
  1230.     return false
  1231. end
  1232.  
  1233. -- Function to check for prizes until no notifications remain
  1234. local function checkAllTabsForPrizes()
  1235.     local PlayerGui = game:GetService("Players").LocalPlayer.PlayerGui
  1236.     local QuestsFrame = PlayerGui.ScreenGui.Quests.Frame
  1237.     local Sidebar = QuestsFrame.Sidebar
  1238.    
  1239.     local hasClaimedAny = false
  1240.     local keepChecking = true
  1241.    
  1242.     -- Keep checking until no more notifications are found
  1243.     while keepChecking do
  1244.         keepChecking = false -- Will be set to true if we find and claim something
  1245.        
  1246.         -- Check buttons with notifications
  1247.         local BubblesButton = Sidebar.Buttons.Bubbles.Button
  1248.         local EggsButton = Sidebar.Buttons.Eggs.Button
  1249.         local QuestsButton = Sidebar.Buttons.Quests.Button
  1250.        
  1251.         -- Check for Bubbles notification
  1252.         local BubblesNotification = BubblesButton:FindFirstChild("Notification")
  1253.         if BubblesNotification and BubblesNotification.Visible then
  1254.             BubblesButton:SetAttribute("Pressed", true)
  1255.             task.wait(0.1)
  1256.             BubblesButton:SetAttribute("Pressed", false)
  1257.             task.wait(1) -- Wait for UI to update
  1258.            
  1259.             -- Try to claim prizes
  1260.             local claimed = CheckAndClaimPrizes()
  1261.             if claimed then
  1262.                 hasClaimedAny = true
  1263.                 keepChecking = true -- Continue checking
  1264.                 task.wait(0.5) -- Short wait before checking again
  1265.                 continue
  1266.             end
  1267.         end
  1268.        
  1269.         -- Check for Eggs notification
  1270.         local EggsNotification = EggsButton:FindFirstChild("Notification")
  1271.         if EggsNotification and EggsNotification.Visible then
  1272.             EggsButton:SetAttribute("Pressed", true)
  1273.             task.wait(0.1)
  1274.             EggsButton:SetAttribute("Pressed", false)
  1275.             task.wait(1) -- Wait for UI to update
  1276.            
  1277.             -- Try to claim prizes
  1278.             local claimed = CheckAndClaimPrizes()
  1279.             if claimed then
  1280.                 hasClaimedAny = true
  1281.                 keepChecking = true -- Continue checking
  1282.                 task.wait(0.5) -- Short wait before checking again
  1283.                 continue
  1284.             end
  1285.         end
  1286.        
  1287.         -- Check Quests tab
  1288.         local QuestsNotification = QuestsButton:FindFirstChild("Notification")
  1289.         if QuestsNotification and QuestsNotification.Visible then
  1290.             QuestsButton:SetAttribute("Pressed", true)
  1291.             task.wait(0.1)
  1292.             QuestsButton:SetAttribute("Pressed", false)
  1293.             task.wait(1) -- Wait for UI to update
  1294.            
  1295.             -- Try to claim prizes
  1296.             local claimed = CheckAndClaimPrizes()
  1297.             if claimed then
  1298.                 hasClaimedAny = true
  1299.                 keepChecking = true -- Continue checking
  1300.                 task.wait(0.5) -- Short wait before checking again
  1301.                 continue
  1302.             end
  1303.         end
  1304.     end
  1305.    
  1306.     -- Always end on the Quests tab
  1307.     local QuestsButton = Sidebar.Buttons.Quests.Button
  1308.     QuestsButton:SetAttribute("Pressed", true)
  1309.     task.wait(0.1)
  1310.     QuestsButton:SetAttribute("Pressed", false)
  1311.    
  1312.     return hasClaimedAny
  1313. end
  1314.  
  1315. -- Function to toggle automatic prize claiming
  1316. local function toggleAutoClaimPrizes()
  1317.     AutoClaimPrizes_Toggle = not AutoClaimPrizes_Toggle
  1318.    
  1319.     if AutoClaimPrizes_Toggle then
  1320.         -- Start a new thread for continuous prize claiming
  1321.         autoClaimingPrizeThread = spawn(function()
  1322.             while AutoClaimPrizes_Toggle do
  1323.                 checkAllTabsForPrizes()
  1324.                 task.wait(60) -- Check for prizes every 60 seconds
  1325.             end
  1326.         end)
  1327.     end
  1328.    
  1329.     return AutoClaimPrizes_Toggle
  1330. end
  1331.  
  1332. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Auto Wheel Spin Function โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  1333.  
  1334. local AutoWheelSpin_Toggle = false -- Flag to track if we're automatically spinning the wheel
  1335. local autoSpinningWheelThread = nil -- Variable to store the auto wheel spinning thread
  1336.  
  1337. local function WheelSpinButtonClick()
  1338.     local WheelSpin = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui.WheelSpin.Frame.Main.Spin.Button
  1339.     WheelSpin:SetAttribute("Pressed", true)
  1340.     task.wait(0.1)
  1341.     WheelSpin:SetAttribute("Pressed", false)
  1342. end
  1343.  
  1344. local function toggleAutoWheelSpin()
  1345.     AutoWheelSpin_Toggle = not AutoWheelSpin_Toggle
  1346.    
  1347.     if AutoWheelSpin_Toggle then
  1348.         -- Start a new thread for continuous wheel spin checking
  1349.         autoSpinningWheelThread = spawn(function()
  1350.             while AutoWheelSpin_Toggle do
  1351.                 local shouldContinueSpinning = false
  1352.                
  1353.                 -- Use pcall for error handling
  1354.                 pcall(function()
  1355.                     -- Get fresh data directly from the LocalDataService
  1356.                     local freshData = LocalDataService:Get()
  1357.                    
  1358.                     -- Check if the player has Spin Tickets in their Powerups
  1359.                     local spinTickets = freshData.Powerups and freshData.Powerups["Spin Ticket"] or 0
  1360.                    
  1361.                     -- Check if wheel spin UI exists for free spin
  1362.                     local wheelSpinUI = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui.WheelSpin
  1363.                    
  1364.                     if wheelSpinUI and wheelSpinUI.Frame and wheelSpinUI.Frame.Main then
  1365.                         local Main = wheelSpinUI.Frame.Main
  1366.                        
  1367.                         -- Check for free spin
  1368.                         if Main.Buttons and Main.Buttons.Free and
  1369.                            Main.Buttons.Free.Button and
  1370.                            Main.Buttons.Free.Button.Title and
  1371.                            Main.Buttons.Free.Button.Title.Text == "Claim" then
  1372.                            
  1373.                             -- Claim the free spin
  1374.                             game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("ClaimFreeWheelSpin")
  1375.                             task.wait(1) -- Wait a bit after claiming
  1376.                            
  1377.                             -- Refresh data after claiming
  1378.                             freshData = LocalDataService:Get()
  1379.                             spinTickets = freshData.Powerups and freshData.Powerups["Spin Ticket"] or 0
  1380.                         end
  1381.                     end
  1382.                    
  1383.                     -- If spin tickets are available in inventory, use them
  1384.                     if spinTickets > 0 then
  1385.  
  1386.                         WheelSpinButtonClick()
  1387.                         --game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Function:InvokeServer("WheelSpin")
  1388.                         task.wait(15) -- Wait longer after spinning to let animations complete
  1389.                        
  1390.                         -- Refresh data after using a spin ticket
  1391.                         freshData = LocalDataService:Get()
  1392.                         spinTickets = freshData.Powerups and freshData.Powerups["Spin Ticket"] or 0
  1393.                        
  1394.                         -- If we still have tickets, set flag to continue spinning without waiting
  1395.                         if spinTickets > 0 then
  1396.                             shouldContinueSpinning = true
  1397.                         end
  1398.                     end
  1399.                 end)
  1400.                
  1401.                 -- Skip the wait and continue spinning if we have more tickets
  1402.                 if shouldContinueSpinning then
  1403.                     task.wait(0.1) -- Small wait to prevent overwhelming the server
  1404.                 else
  1405.                     -- Wait before checking again
  1406.                     task.wait(60) -- Check every 3 minutes
  1407.                 end
  1408.             end
  1409.         end)
  1410.     end
  1411.    
  1412.     return AutoWheelSpin_Toggle
  1413. end
  1414.  
  1415. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Set Settings โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  1416.  
  1417. local SetSettings_Toggle = false
  1418. local SettingsThread = nil
  1419. local settingsApplied = false
  1420.  
  1421. local function SetOptimalSettings()
  1422.     -- Don't run if settings are already applied
  1423.     if settingsApplied then
  1424.         return settingsApplied
  1425.     end
  1426.  
  1427.     SetSettings_Toggle = not SetSettings_Toggle
  1428.    
  1429.     if SetSettings_Toggle then
  1430.         SettingsThread = spawn(function()
  1431.             -- Settings to optimize gameplay
  1432.             local optimalSettings = {
  1433.                 ["Hide Bubbles"] = true,
  1434.                 ["Hide Others Pets"] = true,
  1435.                 ["Hide All Pets"] = true,
  1436.                 ["Compact Pet Inventory"] = true,
  1437.                 ["Skip Easy Legendary"] = true,
  1438.                 ["Music"] = 0,
  1439.                 ["Sound Effects"] = 0
  1440.             }
  1441.            
  1442.             -- Maximum retries to prevent getting stuck
  1443.             local maxRetries = 3
  1444.             local retryCount = 0
  1445.            
  1446.             while retryCount < maxRetries and SetSettings_Toggle do
  1447.                 -- Get fresh data
  1448.                 local data = LocalDataService:Get()
  1449.                 local Settings = data.Settings or {}
  1450.                
  1451.                 -- Check if any settings need to be applied
  1452.                 local settingsToApply = {}
  1453.                 local allSettingsMatch = true
  1454.                
  1455.                 for setting, value in pairs(optimalSettings) do
  1456.                     -- Skip settings that don't exist
  1457.                     if Settings[setting] == nil then
  1458.                         continue
  1459.                     end
  1460.                    
  1461.                     local settingMatches = false
  1462.                    
  1463.                     if setting == "Music" or setting == "Sound Effects" then
  1464.                         settingMatches = Settings[setting] <= 1
  1465.                     else
  1466.                         settingMatches = Settings[setting] == value
  1467.                     end
  1468.                    
  1469.                     if not settingMatches then
  1470.                         allSettingsMatch = false
  1471.                         table.insert(settingsToApply, {setting = setting, value = value})
  1472.                     end
  1473.                 end
  1474.                
  1475.                 -- If all settings match optimal values, we're done
  1476.                 if allSettingsMatch then
  1477.                     break
  1478.                 end
  1479.                
  1480.                 -- Apply each setting that needs changing
  1481.                 for _, settingData in ipairs(settingsToApply) do
  1482.                     Remote.Event:FireServer("SetSetting", settingData.setting, settingData.value)
  1483.                     task.wait(0.3)  -- Slightly longer delay to ensure each setting is processed
  1484.                 end
  1485.                
  1486.                 -- Wait for settings to apply
  1487.                 task.wait(1.5)
  1488.                
  1489.                 -- Increment retry counter
  1490.                 retryCount = retryCount + 1
  1491.             end
  1492.            
  1493.             -- Mark as complete regardless of verification outcome
  1494.             SetSettings_Toggle = false
  1495.             settingsApplied = true
  1496.         end)
  1497.     end
  1498.    
  1499.     return settingsApplied
  1500. end
  1501.  
  1502. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Auto Hide Overlay โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  1503.  
  1504. local AutoHideOverlay_Toggle = false -- Flag to track if we're automatically hiding overlays
  1505. local autoHidingOverlayThread = nil -- Variable to store the auto hiding thread
  1506.  
  1507. local function toggleAutoHideOverlay()
  1508.     AutoHideOverlay_Toggle = not AutoHideOverlay_Toggle
  1509.    
  1510.     if AutoHideOverlay_Toggle then
  1511.         -- Start a new thread for continuous overlay checking
  1512.         autoHidingOverlayThread = spawn(function()
  1513.             while AutoHideOverlay_Toggle do
  1514.                 -- Use pcall for error handling
  1515.                 pcall(function()
  1516.                     -- Check if the overlay exists and is visible
  1517.                     local overlay = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui:FindFirstChild("_overlay")
  1518.                     local dailyRWD = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui:FindFirstChild("DailyRewards")
  1519.                     local PlyTime = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui:FindFirstChild("Playtime")
  1520.                     local Mstry = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui:FindFirstChild("Mastery")
  1521.                     local Qust = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui:FindFirstChild("Quests")
  1522.                     local Sesson = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui:FindFirstChild("Season")
  1523.                     local NotifGame = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui:FindFirstChild("HUD") and
  1524.                                     game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui.HUD:FindFirstChild("NotifyGame")
  1525.                     local Prompts = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui:FindFirstChild("Prompt")
  1526.                     local WorldMp = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui:FindFirstChild("WorldMap")
  1527.                     local UpdateNews = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui:FindFirstChild("_changelog")
  1528.  
  1529.                     if WorldMp and WorldMp.Visible then
  1530.                         -- Set the overlay to not visible
  1531.                         WorldMp.Visible = false
  1532.                     end
  1533.  
  1534.                     if overlay and overlay.Visible then
  1535.                         -- Set the overlay to not visible
  1536.                         overlay.Visible = false
  1537.                     end
  1538.  
  1539.                     if dailyRWD and dailyRWD.Visible then
  1540.                         -- Set the overlay to not visible
  1541.                         dailyRWD.Visible = false
  1542.                     end
  1543.  
  1544.                     if PlyTime and PlyTime.Visible then
  1545.                         -- Set the overlay to not visible
  1546.                         PlyTime.Visible = false
  1547.                     end
  1548.  
  1549.                     if Mstry and Mstry.Visible then
  1550.                         -- Set the overlay to not visible
  1551.                         Mstry.Visible = false
  1552.                     end
  1553.  
  1554.                     if Qust and Qust.Visible then
  1555.                         -- Set the overlay to not visible
  1556.                         Qust.Visible = false
  1557.                     end
  1558.  
  1559.                     if Sesson and Sesson.Visible then
  1560.                         -- Set the overlay to not visible
  1561.                         Sesson.Visible = false
  1562.                     end
  1563.  
  1564.                     if NotifGame and NotifGame.Visible then
  1565.                         -- Set the overlay to not visible
  1566.                         NotifGame.Visible = false
  1567.                     end
  1568.  
  1569.                     if Prompts and Prompts.Visible then
  1570.                         -- Set the overlay to not visible
  1571.                         Prompts.Visible = false
  1572.                     end
  1573.  
  1574.                     if UpdateNews and UpdateNews.Visible then
  1575.                         -- Set the overlay to not visible
  1576.                         UpdateNews.Visible = false
  1577.                     end
  1578.  
  1579.                 end)
  1580.                
  1581.                 -- Wait before checking again
  1582.                 task.wait(20) -- Check every 20 seconds
  1583.             end
  1584.         end)
  1585.     end
  1586.    
  1587.     return AutoHideOverlay_Toggle
  1588. end
  1589.  
  1590. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Auto Fly โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  1591.  
  1592. local isFlyModeActive = false
  1593. local flyModeThread = nil
  1594.  
  1595. local function toggleFlyMode()
  1596.     isFlyModeActive = not isFlyModeActive
  1597.    
  1598.     if isFlyModeActive then
  1599.         flyModeThread = spawn(function()
  1600.             while isFlyModeActive do
  1601.                 pcall(function()
  1602.                     local player = game:GetService("Players").LocalPlayer
  1603.                     local character = player.Character
  1604.                     if not character then return end
  1605.                    
  1606.                     local humanoid = character:FindFirstChild("Humanoid")
  1607.                     local rootPart = character:FindFirstChild("HumanoidRootPart")
  1608.                     if not humanoid or not rootPart then return end
  1609.                    
  1610.                     local camera = workspace.CurrentCamera
  1611.                     local UIS = game:GetService("UserInputService")
  1612.                     local flySpeed = humanoid.WalkSpeed * 0.9
  1613.                    
  1614.                     -- Check if Gyro exists in rootPart, create if not
  1615.                     local Gyro = rootPart:FindFirstChild("Gyro")
  1616.                     if not Gyro then
  1617.                         Gyro = Instance.new("BodyGyro")
  1618.                         Gyro.Name = "Gyro"
  1619.                         Gyro.P = 9e4
  1620.                         Gyro.MaxTorque = Vector3.new(9e9, 9e9, 9e9)
  1621.                         Gyro.Parent = rootPart
  1622.                     end
  1623.                    
  1624.                     -- Check if BodyVelocity exists in rootPart, create if not
  1625.                     local Velocity = rootPart:FindFirstChild("BodyVelocity")
  1626.                     if not Velocity then
  1627.                         Velocity = Instance.new("BodyVelocity")
  1628.                         Velocity.Name = "BodyVelocity"
  1629.                         Velocity.MaxForce = Vector3.new(9e9, 9e9, 9e9)
  1630.                         Velocity.Velocity = Vector3.zero
  1631.                         Velocity.Parent = rootPart
  1632.                     end
  1633.                    
  1634.                     -- Set platform stand
  1635.                     humanoid.PlatformStand = true
  1636.                    
  1637.                     -- Update Gyro CFrame
  1638.                     Gyro.CFrame = CFrame.new(rootPart.Position, rootPart.Position + camera.CFrame.LookVector)
  1639.                    
  1640.                     -- Calculate movement direction based on key presses
  1641.                     local moveDir = Vector3.new(0,0,0)
  1642.                     if UIS:IsKeyDown(Enum.KeyCode.W) then moveDir = moveDir + camera.CFrame.LookVector end
  1643.                     if UIS:IsKeyDown(Enum.KeyCode.S) then moveDir = moveDir - camera.CFrame.LookVector end
  1644.                     if UIS:IsKeyDown(Enum.KeyCode.A) then moveDir = moveDir - camera.CFrame.RightVector end
  1645.                     if UIS:IsKeyDown(Enum.KeyCode.D) then moveDir = moveDir + camera.CFrame.RightVector end
  1646.                     if UIS:IsKeyDown(Enum.KeyCode.E) then moveDir = moveDir + Vector3.new(0,1,0) end
  1647.                     if UIS:IsKeyDown(Enum.KeyCode.Q) then moveDir = moveDir - Vector3.new(0,1,0) end
  1648.                    
  1649.                     -- Apply speed
  1650.                     if moveDir.Magnitude > 0 then moveDir = moveDir.Unit * flySpeed end
  1651.                     Velocity.Velocity = moveDir
  1652.                 end)
  1653.                
  1654.                 task.wait(0.1)
  1655.             end
  1656.         end)
  1657.     else
  1658.         -- Clean up when toggled off
  1659.         pcall(function()
  1660.             local player = game:GetService("Players").LocalPlayer
  1661.             local character = player.Character
  1662.             if character then
  1663.                 local humanoid = character:FindFirstChild("Humanoid")
  1664.                 local rootPart = character:FindFirstChild("HumanoidRootPart")
  1665.                
  1666.                 if humanoid then humanoid.PlatformStand = false end
  1667.                
  1668.                 if rootPart then
  1669.                     local Gyro = rootPart:FindFirstChild("Gyro")
  1670.                     local Velocity = rootPart:FindFirstChild("BodyVelocity")
  1671.                    
  1672.                     if Gyro then Gyro:Destroy() end
  1673.                     if Velocity then Velocity:Destroy() end
  1674.                 end
  1675.             end
  1676.         end)
  1677.     end
  1678.    
  1679.     return isFlyModeActive
  1680. end
  1681.  
  1682. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Auto Press B โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  1683.  
  1684. local isPressingB = false -- Flag to track if we're pressing B periodically
  1685. local pressingBThread = nil -- Variable to store the pressing B thread
  1686.  
  1687. -- Function to toggle periodic B key pressing
  1688. local function togglePeriodicB()
  1689.     isPressingB = not isPressingB
  1690.    
  1691.     if isPressingB then
  1692.         -- Start a new thread for periodic B key pressing
  1693.         pressingBThread = spawn(function()
  1694.             while isPressingB do
  1695.                 -- Press B key
  1696.                 VIM:SendKeyEvent(true, "B", false, game) -- Press B
  1697.                 task.wait(0.01)
  1698.                 VIM:SendKeyEvent(false, "B", false, game) -- Release B
  1699.                 task.wait(1)
  1700.                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("BeginSeasonInfinite")
  1701.                 task.wait(1)
  1702.                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("ChallengePassClaimAll")
  1703.                 task.wait(1)
  1704.                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("ClaimCompetitivePrize", 1, 1)
  1705.                 task.wait(1)
  1706.                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("ClaimCompetitivePrize", 2, 1)
  1707.                 task.wait(1)
  1708.                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("ClaimCompetitivePrize", 3, 1)
  1709.                 task.wait(1)
  1710.                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("ClaimCompetitivePrize", 4, 2)
  1711.                 task.wait(1)
  1712.                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("ClaimCompetitivePrize", 5, 1)
  1713.                 task.wait(1)
  1714.                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("ClaimCompetitivePrize", 6, 1)
  1715.                 task.wait(1)
  1716.                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("ClaimCompetitivePrize", 7, 2)
  1717.                 task.wait(1)
  1718.                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("ClaimCompetitivePrize", 8, 2)
  1719.                 task.wait(1)
  1720.                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("ClaimCompetitivePrize", 9, 1)
  1721.                 task.wait(1)
  1722.                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("ClaimCompetitivePrize", 10, 1)
  1723.                 task.wait(1)
  1724.                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("ClaimCompetitivePrize", 11, 1)
  1725.                 task.wait(1)
  1726.                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("ClaimChest", "Giant Chest", true)
  1727.                 task.wait(1)
  1728.                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("ClaimChest", "Void Chest", true)
  1729.                 task.wait(1)
  1730.                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("UnlockHatchingZone")
  1731.                 task.wait(1)
  1732.                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("ClaimSeason")
  1733.                 task.wait(1)  
  1734.                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("DoggyJumpWin", 1)
  1735.                 task.wait(1)
  1736.                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("DoggyJumpWin", 2)
  1737.                 task.wait(1)
  1738.                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("DoggyJumpWin", 3)
  1739.                 task.wait(1)
  1740.                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("ClaimChest", "Void Chest")
  1741.                 task.wait(1)
  1742.                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("ClaimChest", "Giant Chest")
  1743.                 task.wait(5)
  1744.                
  1745.                 -- Wait for 1 minute before pressing again
  1746.                 task.wait(180)
  1747.             end
  1748.         end)
  1749.     end
  1750.    
  1751.     return isPressingB
  1752. end
  1753.  
  1754. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Auto Mastery Function โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  1755.  
  1756. local function SimulateMasteryBuffButtonClick()
  1757.     local BuffButton = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui.Mastery.Container.Left.ScrollingFrame.Buffs.Button
  1758.     BuffButton:SetAttribute("Pressed", true)
  1759.     task.wait(0.1)
  1760.     BuffButton:SetAttribute("Pressed", false)
  1761. end
  1762.  
  1763. local function SimulateMasteryPetButtonClick()
  1764.     local PetButton = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui.Mastery.Container.Left.ScrollingFrame.Pets.Button
  1765.     PetButton:SetAttribute("Pressed", true)
  1766.     task.wait(0.1)
  1767.     PetButton:SetAttribute("Pressed", false)
  1768. end
  1769.  
  1770. local function SimulateMasteryShopButtonClick()
  1771.     local ShopButton = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui.Mastery.Container.Left.ScrollingFrame.Shops.Button
  1772.     ShopButton:SetAttribute("Pressed", true)
  1773.     task.wait(0.1)
  1774.     ShopButton:SetAttribute("Pressed", false)
  1775. end
  1776.  
  1777. local function FindAvailableAndMastery()
  1778.     isAutoMastery = not isAutoMastery
  1779.    
  1780.     if isAutoMastery then
  1781.         autoMasteryThread = spawn(function()
  1782.             while isAutoMastery do
  1783.                 -- Get current mastery levels from data
  1784.                 local freshData = LocalDataService:Get()
  1785.                
  1786.                 -- Handle different data structures for MasteryLevels
  1787.                 local masteryLevels = {Pets = 0, Buffs = 0, Shops = 0}
  1788.                
  1789.                 -- Check if MasteryLevels exists and is a table
  1790.                 if freshData.MasteryLevels and type(freshData.MasteryLevels) == "table" then
  1791.                     -- Check if it's an object with properties
  1792.                     if freshData.MasteryLevels.Pets ~= nil then
  1793.                         -- It's an object, get values or default to 0
  1794.                         masteryLevels = {
  1795.                             Pets = freshData.MasteryLevels.Pets or 0,
  1796.                             Buffs = freshData.MasteryLevels.Buffs or 0,
  1797.                             Shops = freshData.MasteryLevels.Shops or 0
  1798.                         }
  1799.                     end
  1800.                 end
  1801.                
  1802.                 -- Update the mastery completion flags
  1803.                 PetsMasteryCompleted = (masteryLevels.Pets or 0) >= Target_Pets_Mastery
  1804.                 BuffsMasteryCompleted = (masteryLevels.Buffs or 0) >= Target_Buffs_Mastery
  1805.                 ShopsMasteryCompleted = (masteryLevels.Shops or 0) >= Target_Shops_Mastery
  1806.                 AllMasteryCompleted = PetsMasteryCompleted and BuffsMasteryCompleted and ShopsMasteryCompleted
  1807.                
  1808.                 -- Determine which category to focus on based on priority using global target variables
  1809.                 local upgradePets = not PetsMasteryCompleted
  1810.                 local upgradeBuffs = PetsMasteryCompleted and not BuffsMasteryCompleted
  1811.                 local upgradeShops = PetsMasteryCompleted and BuffsMasteryCompleted and not ShopsMasteryCompleted
  1812.                
  1813.                 -- Function to attempt upgrades within a category
  1814.                 local function attemptUpgradesInCategory()
  1815.                     -- Get the Mastery UI
  1816.                     local MasteryFrame = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui.Mastery
  1817.                    
  1818.                     if not (MasteryFrame and MasteryFrame.Container and
  1819.                             MasteryFrame.Container.Right and
  1820.                             MasteryFrame.Container.Right.ScrollingFrame) then
  1821.                         return false
  1822.                     end
  1823.                    
  1824.                     local ScrollingFrame = MasteryFrame.Container.Right.ScrollingFrame
  1825.                     local madeUpgrade = false
  1826.                    
  1827.                     -- Loop through all templates to find upgrades
  1828.                     for _, template in pairs(ScrollingFrame:GetChildren()) do
  1829.                         if template.Name == "Template" then
  1830.                             local Content = template:FindFirstChild("Content")
  1831.                             if Content then
  1832.                                 local Purchase = Content:FindFirstChild("Purchase")
  1833.                                 if Purchase then
  1834.                                     local Button = Purchase:FindFirstChild("Button")
  1835.                                     if Button then
  1836.                                         local Label = Button:FindFirstChild("Label")
  1837.                                         if Label and Label.Text then
  1838.                                             -- Check if it's free
  1839.                                             if Label.Text == "FREE" or Label.Text == "0" then
  1840.                                                 -- Click the button
  1841.                                                 Button:SetAttribute("Pressed", true)
  1842.                                                 task.wait(0.1)
  1843.                                                 Button:SetAttribute("Pressed", false)
  1844.                                                 madeUpgrade = true
  1845.                                                 task.wait(0.2)
  1846.                                                 return true
  1847.                                             end
  1848.                                            
  1849.                                             -- Determine currency type
  1850.                                             local isCoinPrice = true  -- Default to Coin
  1851.                                             local isGemPrice = false
  1852.                                            
  1853.                                             -- Look for currency icon
  1854.                                             for _, child in pairs(Button:GetChildren()) do
  1855.                                                 if child:IsA("ImageLabel") or child:IsA("ImageButton") then
  1856.                                                     if child.Image and child.Image:match("122003296498191") then
  1857.                                                         isCoinPrice = false
  1858.                                                         isGemPrice = true
  1859.                                                         break
  1860.                                                     elseif child.Image and child.Image:match("121401017387099") then
  1861.                                                         isCoinPrice = true
  1862.                                                         isGemPrice = false
  1863.                                                         break
  1864.                                                     end
  1865.                                                 end
  1866.                                             end
  1867.                                            
  1868.                                             -- Get the price value
  1869.                                             local price = convertPriceToNumber(Label.Text)
  1870.                                            
  1871.                                             -- Check resources - using the existing functions
  1872.                                             local currentCoins = GetCurrentCoins()
  1873.                                             local currentGems = GetCurrentGems()
  1874.                                            
  1875.                                             local canAfford = false
  1876.                                             if isCoinPrice and currentCoins >= price then
  1877.                                                 canAfford = true
  1878.                                             elseif isGemPrice and currentGems >= price then
  1879.                                                 canAfford = true
  1880.                                             end
  1881.                                            
  1882.                                             -- If we can afford it, make the purchase
  1883.                                             if canAfford then
  1884.                                                 Button:SetAttribute("Pressed", true)
  1885.                                                 task.wait(0.1)
  1886.                                                 Button:SetAttribute("Pressed", false)
  1887.                                                 madeUpgrade = true
  1888.                                                 task.wait(0.2)
  1889.                                                 return true
  1890.                                             end
  1891.                                         end
  1892.                                     end
  1893.                                 end
  1894.                             end
  1895.                         end
  1896.                     end
  1897.                    
  1898.                     return madeUpgrade
  1899.                 end
  1900.                
  1901.                 -- Process upgrades by priority:
  1902.                 -- First focus on Pets until they reach target, then Buffs, then Shops
  1903.                 if upgradePets then
  1904.                     SimulateMasteryPetButtonClick()
  1905.                     task.wait(0.5)
  1906.                     attemptUpgradesInCategory()
  1907.                 elseif upgradeBuffs then
  1908.                     SimulateMasteryBuffButtonClick()
  1909.                     task.wait(0.5)
  1910.                     attemptUpgradesInCategory()
  1911.                 elseif upgradeShops then
  1912.                     SimulateMasteryShopButtonClick()
  1913.                     task.wait(0.5)
  1914.                     attemptUpgradesInCategory()
  1915.                 else
  1916.                     -- All target levels reached, check all categories for any additional upgrades
  1917.                    
  1918.                     -- Check Pets first
  1919.                     SimulateMasteryPetButtonClick()
  1920.                     task.wait(0.5)
  1921.                     local upgradedPets = attemptUpgradesInCategory()
  1922.                    
  1923.                     if not upgradedPets then
  1924.                         -- Then check Buffs
  1925.                         SimulateMasteryBuffButtonClick()
  1926.                         task.wait(0.5)
  1927.                         local upgradedBuffs = attemptUpgradesInCategory()
  1928.                        
  1929.                         if not upgradedBuffs then
  1930.                             -- Finally check Shops
  1931.                             SimulateMasteryShopButtonClick()
  1932.                             task.wait(0.5)
  1933.                             attemptUpgradesInCategory()
  1934.                         end
  1935.                     end
  1936.                 end
  1937.                
  1938.                 -- Wait before next check
  1939.                 task.wait(10)
  1940.             end
  1941.         end)
  1942.     end
  1943.    
  1944.     return isAutoMastery
  1945. end
  1946.  
  1947. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Reroll Function โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  1948.  
  1949. local RerollEnchants_Toggle = false
  1950. local RerollThread = nil
  1951.  
  1952. local function hasAnyDesiredEnchant(pet)
  1953.     if not pet or not pet.Enchants then return false end
  1954.     for _, enchant in ipairs(pet.Enchants) do
  1955.         local requiredLevel = enchants[enchant.Id]
  1956.         if requiredLevel and enchant.Level >= requiredLevel then
  1957.             return true
  1958.         end
  1959.     end
  1960.     return false
  1961. end
  1962.  
  1963. local function RerollEnchants()
  1964.     RerollEnchants_Toggle = not RerollEnchants_Toggle
  1965.    
  1966.     if RerollEnchants_Toggle then
  1967.         -- Start a new thread for continuous enchant rerolling
  1968.         RerollThread = spawn(function()
  1969.             while RerollEnchants_Toggle do
  1970.                 -- Get the current team, which will refresh every cycle
  1971.                 local data = LocalDataService:Get()
  1972.                 local currentTeam = data.Teams[1].Pets
  1973.                
  1974.                 for _, uuid in ipairs(currentTeam) do
  1975.                     local pet = getPetById(data, uuid)
  1976.  
  1977.                     if pet and not hasAnyDesiredEnchant(pet) then
  1978.                         while RerollEnchants_Toggle do
  1979.                             Remote.Function:InvokeServer("RerollEnchants", uuid)
  1980.                             task.wait(0.2)
  1981.  
  1982.                             -- Refresh data after each reroll
  1983.                             local updatedData = LocalDataService:Get()
  1984.                             pet = getPetById(updatedData, uuid)
  1985.  
  1986.                             if hasAnyDesiredEnchant(pet) then
  1987.                                 break
  1988.                             end
  1989.                         end
  1990.                     end
  1991.                 end
  1992.                
  1993.                 -- After checking all pets, wait before rechecking to catch any team changes
  1994.                 task.wait(60)
  1995.             end
  1996.         end)
  1997.     end
  1998.    
  1999.     return RerollEnchants_Toggle
  2000. end
  2001.  
  2002. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Auto Buy Gum and Flavors โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  2003.  
  2004. -- Function to get the highest priced item from a config table
  2005. local function get_Highest_Priced_Item(config_table)
  2006.     local highest_price = 0
  2007.     local highest_item_name = nil
  2008.    
  2009.     for item_name, item_data in pairs(config_table) do
  2010.         if item_data.price > highest_price then
  2011.             highest_price = item_data.price
  2012.             highest_item_name = item_name
  2013.         end
  2014.     end
  2015.    
  2016.     return highest_item_name
  2017. end
  2018.  
  2019. -- Get the dynamic max items
  2020. local max_flavor_item = get_Highest_Priced_Item(flavorsConfig)
  2021. local max_gum_item = get_Highest_Priced_Item(gumConfig)
  2022.  
  2023. local function AutoBuyItems()
  2024.     -- Refresh the max items in case the configs changed
  2025.     max_flavor_item = get_Highest_Priced_Item(flavorsConfig)
  2026.     max_gum_item = get_Highest_Priced_Item(gumConfig)
  2027.    
  2028.     AutoBuy_Toggle = not AutoBuy_Toggle
  2029.    
  2030.     if AutoBuy_Toggle then
  2031.         Buy_Thread = spawn(function()
  2032.             -- First check if we already have max upgrades
  2033.             local freshData = LocalDataService:Get()
  2034.            
  2035.             -- Check for max flavor using dynamic highest item
  2036.             if freshData.Flavors and freshData.Flavors[max_flavor_item] then
  2037.                 max_Flavor_Reached = true
  2038.             end
  2039.            
  2040.             -- Check for max gum using dynamic highest item
  2041.             if freshData.Gum and freshData.Gum[max_gum_item] then
  2042.                 max_Gum_Reached = true
  2043.             end
  2044.            
  2045.             -- Set combined flag
  2046.             max_Upgrades_Reached = max_Flavor_Reached and max_Gum_Reached
  2047.            
  2048.             -- If both are already maxed, no need to continue
  2049.             if max_Upgrades_Reached then
  2050.                 AutoBuy_Toggle = false
  2051.                 return
  2052.             end
  2053.            
  2054.             while AutoBuy_Toggle do
  2055.                 local freshData = LocalDataService:Get()
  2056.                
  2057.                 -- Update max status flags with fresh data
  2058.                 if freshData.Flavors and freshData.Flavors[max_flavor_item] then
  2059.                     max_Flavor_Reached = true
  2060.                 end
  2061.                
  2062.                 if freshData.Gum and freshData.Gum[max_gum_item] then
  2063.                     max_Gum_Reached = true
  2064.                 end
  2065.                
  2066.                 max_Upgrades_Reached = max_Flavor_Reached and max_Gum_Reached
  2067.                
  2068.                 -- Check if all items are already purchased
  2069.                 if max_Upgrades_Reached then
  2070.                     AutoBuy_Toggle = false
  2071.                     break
  2072.                 end
  2073.                
  2074.                 -- Sort flavors by price (lowest first) if we haven't reached max flavor
  2075.                 if not max_Flavor_Reached then
  2076.                     local flavors_To_Buy = {}
  2077.                    
  2078.                     for flavorName, config in pairs(flavorsConfig) do
  2079.                         if not freshData.Flavors[flavorName] then
  2080.                             table.insert(flavors_To_Buy, {name = flavorName, config = config})
  2081.                         end
  2082.                     end
  2083.                    
  2084.                     table.sort(flavors_To_Buy, function(a, b)
  2085.                         if a.config.currency == b.config.currency then
  2086.                             return a.config.price < b.config.price
  2087.                         else
  2088.                             return a.config.currency == "Coins" -- Prioritize coins purchases
  2089.                         end
  2090.                     end)
  2091.                    
  2092.                     -- Try to buy flavors in order of price
  2093.                     for _, flavorInfo in ipairs(flavors_To_Buy) do
  2094.                         local flavorName = flavorInfo.name
  2095.                         local config = flavorInfo.config
  2096.                        
  2097.                         local can_Afford = false
  2098.                         if config.currency == "Coins" and GetCurrentCoins() >= config.price then
  2099.                             can_Afford = true
  2100.                         elseif config.currency == "Gems" and GetCurrentGems() >= config.price then
  2101.                             can_Afford = true
  2102.                         end
  2103.                        
  2104.                         if can_Afford then
  2105.                             -- Attempt to buy the flavor using correct remote
  2106.                             Remote.Event:FireServer("GumShopPurchase", flavorName)
  2107.                            
  2108.                             -- Wait a moment for purchase to process
  2109.                             task.wait(0.3)
  2110.                            
  2111.                             -- Refresh data to check if purchase was successful
  2112.                             freshData = LocalDataService:Get()
  2113.                            
  2114.                             -- Check if we've reached max flavor
  2115.                             if freshData.Flavors and freshData.Flavors[max_flavor_item] then
  2116.                                 max_Flavor_Reached = true
  2117.                             end
  2118.                            
  2119.                             -- Small delay between purchases
  2120.                             task.wait(0.5)
  2121.                         end
  2122.                     end
  2123.                 end
  2124.                
  2125.                 -- Sort gums by price (lowest first) if we haven't reached max gum
  2126.                 if not max_Gum_Reached then
  2127.                     local gums_To_Buy = {}
  2128.                     freshData = LocalDataService:Get() -- Refresh data again
  2129.                    
  2130.                     for gumName, config in pairs(gumConfig) do
  2131.                         if not freshData.Gum[gumName] then
  2132.                             table.insert(gums_To_Buy, {name = gumName, config = config})
  2133.                         end
  2134.                     end
  2135.                    
  2136.                     table.sort(gums_To_Buy, function(a, b)
  2137.                         if a.config.currency == b.config.currency then
  2138.                             return a.config.price < b.config.price
  2139.                         else
  2140.                             return a.config.currency == "Coins" -- Prioritize coins purchases
  2141.                         end
  2142.                     end)
  2143.                    
  2144.                     -- Try to buy gums in order of price
  2145.                     for _, gumInfo in ipairs(gums_To_Buy) do
  2146.                         local gumName = gumInfo.name
  2147.                         local config = gumInfo.config
  2148.                        
  2149.                         local can_Afford = false
  2150.                         if config.currency == "Coins" and GetCurrentCoins() >= config.price then
  2151.                             can_Afford = true
  2152.                         elseif config.currency == "Gems" and GetCurrentGems() >= config.price then
  2153.                             can_Afford = true
  2154.                         end
  2155.                        
  2156.                         if can_Afford then
  2157.                             -- Attempt to buy the gum using correct remote
  2158.                             Remote.Event:FireServer("GumShopPurchase", gumName)
  2159.                            
  2160.                             -- Wait a moment for purchase to process
  2161.                             task.wait(0.3)
  2162.                            
  2163.                             -- Refresh data to check if purchase was successful
  2164.                             freshData = LocalDataService:Get()
  2165.                            
  2166.                             -- Check if we've reached max gum
  2167.                             if freshData.Gum and freshData.Gum[max_gum_item] then
  2168.                                 max_Gum_Reached = true
  2169.                             end
  2170.                            
  2171.                             -- Small delay between purchases
  2172.                             task.wait(0.5)
  2173.                         end
  2174.                     end
  2175.                 end
  2176.                
  2177.                 -- Update combined flag
  2178.                 max_Upgrades_Reached = max_Flavor_Reached and max_Gum_Reached
  2179.                
  2180.                 -- Wait before checking again
  2181.                 task.wait(5)
  2182.             end
  2183.         end)
  2184.     end
  2185.    
  2186.     return AutoBuy_Toggle, max_Flavor_Reached, max_Gum_Reached, max_Upgrades_Reached
  2187. end
  2188.  
  2189. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Area Unlock Function โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  2190.  
  2191. local AreaUnlock_Toggle = false
  2192. local AreaThread = nil
  2193. local areasUnlocked = false
  2194.  
  2195. local function UnlockAreas()
  2196.     AreaUnlock_Toggle = not AreaUnlock_Toggle
  2197.    
  2198.     if AreaUnlock_Toggle then
  2199.         AreaThread = spawn(function()
  2200.             -- Get player and character
  2201.             local player = game:GetService("Players").LocalPlayer
  2202.            
  2203.             while AreaUnlock_Toggle do
  2204.                 -- Check current unlocked status
  2205.                 local freshData = LocalDataService:Get()
  2206.                 local allAreasUnlocked = true
  2207.                 local areasToTry = {}
  2208.                
  2209.                 -- Check which areas still need to be unlocked
  2210.                 for _, areaName in ipairs(AreaToUnlock) do
  2211.                     if type(freshData.AreasUnlocked) ~= "table" or not freshData.AreasUnlocked[areaName] then
  2212.                         allAreasUnlocked = false
  2213.                         table.insert(areasToTry, areaName)
  2214.                     end
  2215.                 end
  2216.                
  2217.                 -- If all areas are unlocked, turn off function and exit
  2218.                 if allAreasUnlocked then
  2219.                     AreaUnlock_Toggle = false
  2220.                     areasUnlocked = true
  2221.                     break
  2222.                 end
  2223.                
  2224.                 -- Try to unlock each remaining area
  2225.                 for _, areaName in ipairs(areasToTry) do
  2226.                     if not AreaUnlock_Toggle then break end
  2227.                    
  2228.                     -- Make sure character exists
  2229.                     local character = player.Character or player.CharacterAdded:Wait()
  2230.                     local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
  2231.                    
  2232.                     -- Find the area in Worlds
  2233.                     local areaWithoutSpaces = areaName:gsub(" ", "")
  2234.                     local areaFolder = workspace.Worlds["The Overworld"].Islands:FindFirstChild(areaName) or
  2235.                                      workspace.Worlds["The Overworld"].Islands:FindFirstChild(areaWithoutSpaces)
  2236.                    
  2237.                     if areaFolder then
  2238.                         -- Search for UnlockHitbox using GetDescendants
  2239.                         local unlockHitbox = nil
  2240.                         for _, descendant in ipairs(areaFolder:GetDescendants()) do
  2241.                             if descendant.Name == "UnlockHitbox" then
  2242.                                 unlockHitbox = descendant
  2243.                                 break
  2244.                             end
  2245.                         end
  2246.                        
  2247.                         if unlockHitbox then
  2248.                             -- Teleport to the UnlockHitbox
  2249.                             humanoidRootPart.CFrame = unlockHitbox.CFrame * CFrame.new(0, 15, 0)
  2250.                            
  2251.                             -- Wait a bit for the unlock to register
  2252.                             task.wait(0.1)
  2253.                            
  2254.                             -- Update data to check if area was unlocked
  2255.                             freshData = LocalDataService:Get()
  2256.                            
  2257.                             -- If area is now unlocked, we can move to the next one
  2258.                             if type(freshData.AreasUnlocked) == "table" and freshData.AreasUnlocked[areaName] then
  2259.                                 -- Area successfully unlocked
  2260.                             end
  2261.                         end
  2262.                     end
  2263.                    
  2264.                     -- Wait between areas
  2265.                     task.wait(0.1)
  2266.                 end
  2267.                
  2268.                 -- Wait before checking again
  2269.                 task.wait(0.5)
  2270.             end
  2271.         end)
  2272.     end
  2273.    
  2274.     return AreaUnlock_Toggle
  2275. end
  2276.  
  2277. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Auto Mystery Boxes Function โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  2278.  
  2279. local AutoMysteryBoxes_Toggle = false -- Flag to track if we're automatically using mystery boxes
  2280. local autoMysteryBoxesThread = nil -- Variable to store the auto mystery boxes thread
  2281.  
  2282. -- Function to check and use Mystery Boxes with toggle functionality
  2283. local function toggleAutoMysteryBoxes()
  2284.     AutoMysteryBoxes_Toggle = not AutoMysteryBoxes_Toggle
  2285.    
  2286.     if AutoMysteryBoxes_Toggle then
  2287.         -- Start a new thread for continuous Mystery Box usage
  2288.         autoMysteryBoxesThread = spawn(function()
  2289.             while AutoMysteryBoxes_Toggle do
  2290.                 -- Use pcall to safely check data
  2291.                 pcall(function()
  2292.                     -- Get fresh data directly from the LocalDataService
  2293.                     local freshData = LocalDataService:Get()
  2294.                    
  2295.                     -- Check if the player has Mystery Boxes in their Powerups
  2296.                     local mysteryBoxCount = freshData.Powerups and freshData.Powerups["Mystery Box"] or 0
  2297.                    
  2298.                     if mysteryBoxCount > 0 then
  2299.                         -- Use Mystery Box (10 at a time or all if less than 10)
  2300.                         local amountToUse = math.min(mysteryBoxCount, 10)
  2301.                         game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("UseGift", "Mystery Box", amountToUse)
  2302.                         task.wait(1)
  2303.                        
  2304.                         -- Check for gifts and claim them using the remote event
  2305.                         while true do
  2306.                             -- Check if Gifts folder exists and has children
  2307.                             local giftsFolder = workspace.Rendered:FindFirstChild("Gifts")
  2308.                             if not giftsFolder or #giftsFolder:GetChildren() == 0 then
  2309.                                 break
  2310.                             end
  2311.                            
  2312.                             -- Process each gift in the folder
  2313.                             for _, gift in pairs(giftsFolder:GetChildren()) do
  2314.                                 -- Get the gift's name/UUID
  2315.                                 local giftId = gift.Name
  2316.                                
  2317.                                 -- Claim the gift using the remote event
  2318.                                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("ClaimGift", giftId)
  2319.  
  2320.                                 task.wait(1)
  2321.                                
  2322.                                 -- Destroy the gift after claiming
  2323.                                 gift:Destroy()
  2324.                                
  2325.                                 -- Short wait to prevent overwhelming the server
  2326.                                 task.wait(0.01)
  2327.                             end
  2328.                         end
  2329.                     end
  2330.                 end)
  2331.                
  2332.                 -- Wait before checking again (every 30 seconds)
  2333.                 task.wait(30)
  2334.             end
  2335.         end)
  2336.     end
  2337.    
  2338.     return AutoMysteryBoxes_Toggle
  2339. end
  2340.  
  2341.  
  2342. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Auto Buy Shop Settings โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  2343.  
  2344. local isAutoBuyingShopItems = false
  2345. local autoBuyingShopItemsThread = nil
  2346.  
  2347. local function toggleAutoBuyShopItems()
  2348.     isAutoBuyingShopItems = not isAutoBuyingShopItems
  2349.    
  2350.     if isAutoBuyingShopItems then
  2351.        
  2352.         -- Start the auto buying thread
  2353.         autoBuyingShopItemsThread = spawn(function()
  2354.             while isAutoBuyingShopItems do
  2355.                 -- Define shops and their items for efficient iteration
  2356.                 local shops = {
  2357.                     ["alien-shop"] = {1, 2, 3},
  2358.                     ["shard-shop"] = {1, 2, 3}
  2359.                 }
  2360.                
  2361.                 -- Check if we have minimum gems before attempting purchases
  2362.                 local currentGems = GetCurrentGems()
  2363.                 if currentGems < Low_Gems then
  2364.                     task.wait(60) -- Wait a minute before checking again
  2365.                     continue
  2366.                 end
  2367.                
  2368.                 -- Process each shop
  2369.                 for shopName, items in pairs(shops) do
  2370.                     -- Process each item ID in this shop
  2371.                     for _, itemId in ipairs(items) do
  2372.                         -- Verify we still have enough gems
  2373.                         if GetCurrentGems() >= Low_Gems then
  2374.                             game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer(
  2375.                                 "BuyShopItem",
  2376.                                 shopName,
  2377.                                 itemId
  2378.                             )
  2379.                             task.wait(0.5) -- Wait between purchases
  2380.                         else
  2381.                             task.wait(30) -- If below threshold, wait and continue loop
  2382.                             break
  2383.                         end
  2384.                     end
  2385.                    
  2386.                     -- Check if toggle was turned off during purchases
  2387.                     if not isAutoBuyingShopItems then
  2388.                         break
  2389.                     end
  2390.                    
  2391.                     task.wait(0.5)
  2392.                 end
  2393.                
  2394.                 -- Wait between shop purchase cycles
  2395.                 task.wait(60) -- Wait 1 minute between full cycles
  2396.             end
  2397.         end)
  2398.     else
  2399.         -- Kill the thread if it exists
  2400.         if autoBuyingShopItemsThread then
  2401.             task.cancel(autoBuyingShopItemsThread)
  2402.             autoBuyingShopItemsThread = nil
  2403.         end
  2404.     end
  2405.    
  2406.     return isAutoBuyingShopItems
  2407. end
  2408.  
  2409. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Auto Delete Pets โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  2410.  
  2411. local isAutoDeletingPets = false
  2412. local autoDeletingPetsThread = nil
  2413.  
  2414. local function toggleAutoPetDeletion()
  2415.     isAutoDeletingPets = not isAutoDeletingPets
  2416.    
  2417.     if isAutoDeletingPets then
  2418.         -- Start a new thread for continuous pet deletion
  2419.         autoDeletingPetsThread = spawn(function()
  2420.             while isAutoDeletingPets do
  2421.                 -- Use pcall for error handling
  2422.                 pcall(function()
  2423.                     -- Get fresh data
  2424.                     local freshData = LocalDataService:Get()
  2425.                    
  2426.                     -- Create a lookup table for all pet IDs in teams
  2427.                     local petsInTeams = {}
  2428.                     for _, team in ipairs(freshData.Teams) do
  2429.                         for _, petId in ipairs(team.Pets) do
  2430.                             petsInTeams[petId] = true
  2431.                         end
  2432.                     end
  2433.                    
  2434.                     -- Track pets with shiny versions for auto-delete toggling later
  2435.                     local petsWithShinyVersions = {}
  2436.                    
  2437.                     -- Check which pets have shiny versions
  2438.                     for _, petName in ipairs(petsToDelete) do
  2439.                         local hasShiny = false
  2440.                         for _, pet in ipairs(freshData.Pets) do
  2441.                             if pet.Name == petName and pet.Shiny then
  2442.                                 hasShiny = true
  2443.                                 break
  2444.                             end
  2445.                         end
  2446.                        
  2447.                         if hasShiny then
  2448.                             petsWithShinyVersions[petName] = true
  2449.                         end
  2450.                     end
  2451.                    
  2452.                     -- Check and track all pets by name, separating normal and shiny
  2453.                     local petsByName = {}
  2454.                    
  2455.                     -- First pass: organize pets by name to determine counts and find shiny versions
  2456.                     for _, pet in ipairs(freshData.Pets) do
  2457.                         -- Skip pets that are in teams or locked
  2458.                         if petsInTeams[pet.Id] or pet.Locked then
  2459.                             continue
  2460.                         end
  2461.                        
  2462.                         -- Check if this pet is in our deletion list
  2463.                         local shouldTrack = false
  2464.                         for _, petName in ipairs(petsToDelete) do
  2465.                             if pet.Name == petName then
  2466.                                 shouldTrack = true
  2467.                                 break
  2468.                             end
  2469.                         end
  2470.                        
  2471.                         if shouldTrack then
  2472.                             -- Initialize the pet tracking if not exists
  2473.                             if not petsByName[pet.Name] then
  2474.                                 petsByName[pet.Name] = {
  2475.                                     normal = {
  2476.                                         pets = {},
  2477.                                         count = 0
  2478.                                     },
  2479.                                     shiny = {
  2480.                                         exists = false,
  2481.                                         pets = {},
  2482.                                         count = 0
  2483.                                     }
  2484.                                 }
  2485.                             end
  2486.                            
  2487.                             -- Add to appropriate category
  2488.                             if pet.Shiny then
  2489.                                 petsByName[pet.Name].shiny.exists = true
  2490.                                 table.insert(petsByName[pet.Name].shiny.pets, pet)
  2491.                                 petsByName[pet.Name].shiny.count = petsByName[pet.Name].shiny.count + (pet.Amount or 1)
  2492.                             else
  2493.                                 table.insert(petsByName[pet.Name].normal.pets, pet)
  2494.                                 petsByName[pet.Name].normal.count = petsByName[pet.Name].normal.count + (pet.Amount or 1)
  2495.                             end
  2496.                         end
  2497.                     end
  2498.                    
  2499.                     -- Process each pet name to check for shiny crafting opportunity
  2500.                     for petName, data in pairs(petsByName) do
  2501.                         -- Check if we need to make a shiny (no shiny exists and we have 16+ normal pets)
  2502.                         if not data.shiny.exists and data.normal.count >= 16 then
  2503.                             -- Find best candidate for shiny crafting (preferably a stacked pet)
  2504.                             local bestCandidate = nil
  2505.                            
  2506.                             -- First try to find a stacked pet with at least 16
  2507.                             for _, pet in ipairs(data.normal.pets) do
  2508.                                 if pet.Amount and pet.Amount >= 16 then
  2509.                                     bestCandidate = pet
  2510.                                     break
  2511.                                 end
  2512.                             end
  2513.                            
  2514.                             -- If no stacked pet has 16+, we'll need to use the first pet we find
  2515.                             if not bestCandidate and #data.normal.pets > 0 then
  2516.                                 bestCandidate = data.normal.pets[1]
  2517.                             end
  2518.                            
  2519.                             -- Execute the shiny crafting if we have a candidate
  2520.                             if bestCandidate then
  2521.                                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer(
  2522.                                     "MakePetShiny",
  2523.                                     bestCandidate.Id
  2524.                                 )
  2525.                                
  2526.                                 -- Wait for the operation to complete
  2527.                                 task.wait(1)
  2528.                                
  2529.                                 -- Refresh data after crafting a shiny
  2530.                                 freshData = LocalDataService:Get()
  2531.                                
  2532.                                 -- Update our tracking of pets with shiny versions
  2533.                                 petsWithShinyVersions[petName] = true
  2534.                                
  2535.                                 -- Recreate teams lookup after refresh
  2536.                                 petsInTeams = {}
  2537.                                 for _, team in ipairs(freshData.Teams) do
  2538.                                     for _, petId in ipairs(team.Pets) do
  2539.                                         petsInTeams[petId] = true
  2540.                                     end
  2541.                                 end
  2542.                             end
  2543.                         end
  2544.                     end
  2545.                    
  2546.                     -- Now reorganize for deletion processing with updated data
  2547.                     local petsByNameAndType = {}
  2548.                    
  2549.                     for _, pet in ipairs(freshData.Pets) do
  2550.                         -- Skip pets that are in any team
  2551.                         if petsInTeams[pet.Id] then
  2552.                             continue
  2553.                         end
  2554.                        
  2555.                         -- Skip locked pets
  2556.                         if pet.Locked then
  2557.                             continue
  2558.                         end
  2559.                        
  2560.                         -- Check if this pet is in our deletion list
  2561.                         local shouldTrack = false
  2562.                         for _, petName in ipairs(petsToDelete) do
  2563.                             if pet.Name == petName then
  2564.                                 shouldTrack = true
  2565.                                 break
  2566.                             end
  2567.                         end
  2568.                        
  2569.                         -- Check if we should skip deletion for normal pets where no shiny exists yet
  2570.                         if shouldTrack and not pet.Shiny then
  2571.                             -- Check if we have a shiny version in the data
  2572.                             local shinyExists = petsWithShinyVersions[pet.Name] or false
  2573.                             if not shinyExists then
  2574.                                 -- Re-check in fresh data
  2575.                                 for _, checkPet in ipairs(freshData.Pets) do
  2576.                                     if checkPet.Name == pet.Name and checkPet.Shiny then
  2577.                                         shinyExists = true
  2578.                                         petsWithShinyVersions[pet.Name] = true
  2579.                                         break
  2580.                                     end
  2581.                                 end
  2582.                             end
  2583.                            
  2584.                             -- If no shiny exists yet, we need 16+ pets to make a shiny, so don't delete
  2585.                             if not shinyExists then
  2586.                                 -- Count how many we have of this pet
  2587.                                 local totalCount = 0
  2588.                                 for _, countPet in ipairs(freshData.Pets) do
  2589.                                     if countPet.Name == pet.Name and not countPet.Shiny and not petsInTeams[countPet.Id] and not countPet.Locked then
  2590.                                         totalCount = totalCount + (countPet.Amount or 1)
  2591.                                     end
  2592.                                 end
  2593.                                
  2594.                                 -- Only delete if we have more than 16 of this pet
  2595.                                 if totalCount <= 16 then
  2596.                                     shouldTrack = false
  2597.                                 end
  2598.                             end
  2599.                         end
  2600.                        
  2601.                         -- Only track pets in our deletion list
  2602.                         if shouldTrack then
  2603.                             -- Create a key that combines name and shiny status
  2604.                             local petKey = pet.Name .. (pet.Shiny and "_shiny" or "_normal")
  2605.                            
  2606.                             if not petsByNameAndType[petKey] then
  2607.                                 petsByNameAndType[petKey] = {
  2608.                                     xpPets = {},
  2609.                                     stackedPets = {},
  2610.                                     totalCount = 0,
  2611.                                     isShiny = pet.Shiny,
  2612.                                     name = pet.Name
  2613.                                 }
  2614.                             end
  2615.                            
  2616.                             -- Check if it's a stacked pet (has Amount) or individual XP pet
  2617.                             if pet.Amount then
  2618.                                 table.insert(petsByNameAndType[petKey].stackedPets, pet)
  2619.                                 petsByNameAndType[petKey].totalCount = petsByNameAndType[petKey].totalCount + pet.Amount
  2620.                             else
  2621.                                 table.insert(petsByNameAndType[petKey].xpPets, pet)
  2622.                                 petsByNameAndType[petKey].totalCount = petsByNameAndType[petKey].totalCount + 1
  2623.                             end
  2624.                         end
  2625.                     end
  2626.                    
  2627.                     -- Process each pet type for deletion
  2628.                     for petKey, petData in pairs(petsByNameAndType) do
  2629.                         -- Use appropriate threshold based on shiny status
  2630.                         local threshold = petData.isShiny and shinyKeepThreshold or petKeepThreshold
  2631.                         local totalToDelete = petData.totalCount - threshold
  2632.                        
  2633.                         -- Only proceed if we need to delete pets
  2634.                         if totalToDelete > 0 then
  2635.                             -- First delete individual XP pets (prioritize these)
  2636.                             local refreshNeeded = false
  2637.                            
  2638.                             for i, xpPet in ipairs(petData.xpPets) do
  2639.                                 if totalToDelete > 0 then
  2640.                                     -- Double check that this pet is not in a team
  2641.                                     if not petsInTeams[xpPet.Id] then
  2642.                                         -- Delete this individual pet
  2643.                                         game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer(
  2644.                                             "DeletePet",
  2645.                                             xpPet.Id,
  2646.                                             1,
  2647.                                             false
  2648.                                         )
  2649.                                        
  2650.                                         totalToDelete = totalToDelete - 1
  2651.                                         task.wait(0.3) -- Wait for deletion to process
  2652.                                         refreshNeeded = true
  2653.                                        
  2654.                                         -- Refresh data after each 3 deletions to avoid too many refreshes
  2655.                                         if i % 3 == 0 or totalToDelete <= 0 then
  2656.                                             -- Refresh data and team info
  2657.                                             freshData = LocalDataService:Get()
  2658.                                             petsInTeams = {}
  2659.                                             for _, team in ipairs(freshData.Teams) do
  2660.                                                 for _, petId in ipairs(team.Pets) do
  2661.                                                     petsInTeams[petId] = true
  2662.                                                 end
  2663.                                             end
  2664.                                             refreshNeeded = false
  2665.                                         end
  2666.                                     end
  2667.                                 else
  2668.                                     break
  2669.                                 end
  2670.                             end
  2671.                            
  2672.                             -- Refresh data if needed before handling stacked pets
  2673.                             if refreshNeeded then
  2674.                                 freshData = LocalDataService:Get()
  2675.                                 petsInTeams = {}
  2676.                                 for _, team in ipairs(freshData.Teams) do
  2677.                                     for _, petId in ipairs(team.Pets) do
  2678.                                         petsInTeams[petId] = true
  2679.                                     end
  2680.                                 end
  2681.                             end
  2682.                            
  2683.                             -- Recalculate remaining pets to delete after refreshing data
  2684.                             if totalToDelete > 0 then
  2685.                                 -- Find all stacked pets again with fresh data
  2686.                                 local stackedPets = {}
  2687.                                 for _, pet in ipairs(freshData.Pets) do
  2688.                                     -- Match both name and shiny status, make sure not in team
  2689.                                     local isRightType = pet.Name == petData.name and (pet.Shiny == petData.isShiny)
  2690.                                     if isRightType and pet.Amount and not petsInTeams[pet.Id] and not pet.Locked then
  2691.                                         table.insert(stackedPets, pet)
  2692.                                     end
  2693.                                 end
  2694.                                
  2695.                                 -- Then handle stacked pets if we still need to delete more
  2696.                                 for i, stackedPet in ipairs(stackedPets) do
  2697.                                     if totalToDelete > 0 then
  2698.                                         -- Calculate how many to delete from this stack
  2699.                                         local amountToDelete = math.min(stackedPet.Amount, totalToDelete)
  2700.                                        
  2701.                                         -- Delete from this stacked pet
  2702.                                         game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer(
  2703.                                             "DeletePet",
  2704.                                             stackedPet.Id,
  2705.                                             amountToDelete,
  2706.                                             false
  2707.                                         )
  2708.                                        
  2709.                                         totalToDelete = totalToDelete - amountToDelete
  2710.                                         task.wait(0.3) -- Wait for deletion to process
  2711.                                        
  2712.                                         -- Refresh data after each deletion of stacked pets
  2713.                                         if i % 2 == 0 or totalToDelete <= 0 then
  2714.                                             freshData = LocalDataService:Get()
  2715.                                             petsInTeams = {}
  2716.                                             for _, team in ipairs(freshData.Teams) do
  2717.                                                 for _, petId in ipairs(team.Pets) do
  2718.                                                     petsInTeams[petId] = true
  2719.                                                 end
  2720.                                             end
  2721.                                         end
  2722.                                     else
  2723.                                         break
  2724.                                     end
  2725.                                 end
  2726.                             end
  2727.                         end
  2728.                     end
  2729.                    
  2730.                     -- After deletion, check which pets should be toggled for auto-delete
  2731.                     freshData = LocalDataService:Get() -- Get fresh data again
  2732.                    
  2733.                     -- Enable auto-delete for pets where we have a shiny version
  2734.                     for petName in pairs(petsWithShinyVersions) do
  2735.                         -- Check if this pet is already set for auto-deletion
  2736.                         local isAlreadyAutoDelete = freshData.AutoDelete and freshData.AutoDelete[petName]
  2737.                        
  2738.                         -- If not set for auto-delete yet, toggle it
  2739.                         if not isAlreadyAutoDelete then
  2740.                             game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer(
  2741.                                 "ToggleAutoDelete",
  2742.                                 petName
  2743.                             )
  2744.                             task.wait(0.2) -- Small wait between toggles
  2745.                         end
  2746.                     end
  2747.                 end)
  2748.                
  2749.                 -- Wait before checking again
  2750.                 task.wait(30) -- Check every 30 seconds
  2751.             end
  2752.         end)
  2753.     end
  2754.    
  2755.     return isAutoDeletingPets
  2756. end
  2757.  
  2758. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Auto Craft Potion Function โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  2759.  
  2760. local isAutoCraftingPotions = false
  2761. local autoCraftingPotionsThread = nil
  2762.  
  2763. local function toggleAutoCraftPotions()
  2764.     isAutoCraftingPotions = not isAutoCraftingPotions
  2765.    
  2766.     if isAutoCraftingPotions then
  2767.         autoCraftingPotionsThread = spawn(function()
  2768.             while isAutoCraftingPotions do
  2769.                 -- Check gem threshold first
  2770.                 local currentGems = GetCurrentGems()
  2771.                
  2772.                 -- Only proceed if we have enough gems
  2773.                 if currentGems >= Low_Gems then
  2774.                     local madeCraft = false
  2775.                     local data = LocalDataService:Get()
  2776.                    
  2777.                     -- Check from lowest to highest tier
  2778.                     for tier = 2, 5 do
  2779.                         for _, potionType in ipairs(potionTypes) do
  2780.                             -- Find source potion in inventory
  2781.                             local sourceTier = tier - 1
  2782.                             local required = craftingRequirements[tier]
  2783.                             local available = 0
  2784.                            
  2785.                             for _, potion in ipairs(data.Potions or {}) do
  2786.                                 if potion.Name == potionType and potion.Level == sourceTier then
  2787.                                     available = potion.Amount or 0
  2788.                                     break
  2789.                                 end
  2790.                             end
  2791.                            
  2792.                             -- Craft if possible and check gems again before each craft
  2793.                             if available >= required and GetCurrentGems() >= Low_Gems then
  2794.                                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer(
  2795.                                     "CraftPotion", potionType, tier, true)
  2796.                                 madeCraft = true
  2797.                                 task.wait(0.3)
  2798.                                 data = LocalDataService:Get() -- Refresh data
  2799.                             end
  2800.                         end
  2801.                     end
  2802.                    
  2803.                     -- Wait based on crafting activity
  2804.                     task.wait(madeCraft and 0.5 or 10)
  2805.                 else
  2806.                     -- If not enough gems, wait longer before checking again
  2807.                     task.wait(15)
  2808.                 end
  2809.             end
  2810.         end)
  2811.     end
  2812.    
  2813.     return isAutoCraftingPotions
  2814. end
  2815.  
  2816. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Auto Use Potion Function โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  2817.  
  2818. local function isPotionActive(potionType)
  2819.     -- Get fresh data every time we check
  2820.     local freshData = LocalDataService:Get()
  2821.    
  2822.     -- Check if ActivePotions exists and has the specific potion
  2823.     if freshData.ActivePotions and
  2824.        type(freshData.ActivePotions) == "table" and
  2825.        freshData.ActivePotions[potionType] and
  2826.        freshData.ActivePotions[potionType].Active then
  2827.         return true
  2828.     end
  2829.    
  2830.     return false
  2831. end
  2832.  
  2833. -- Function to get the highest level potion of a specific type from inventory
  2834. local function getHighestLevelPotion(potionType)
  2835.     -- Get fresh data every time we check inventory
  2836.     local freshData = LocalDataService:Get()
  2837.     local highestLevel = 0
  2838.     local highestLevelPotion = nil
  2839.    
  2840.     -- Check if we have potions in inventory
  2841.     if freshData.Potions and #freshData.Potions > 0 then
  2842.         for _, potion in ipairs(freshData.Potions) do
  2843.             -- Check if this potion matches the exact type we're looking for
  2844.             if potion.Name == potionType and potion.Amount > 0 then
  2845.                 -- If this potion has a higher level than our current highest, update
  2846.                 if potion.Level > highestLevel then
  2847.                     highestLevel = potion.Level
  2848.                     highestLevelPotion = potion
  2849.                 end
  2850.             end
  2851.         end
  2852.     end
  2853.    
  2854.     return highestLevelPotion
  2855. end
  2856.  
  2857. -- Function to use a potion
  2858. local function usePotion(potionName, potionLevel)
  2859.     -- Use the potion
  2860.     game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer(
  2861.         "UsePotion",
  2862.         potionName,
  2863.         potionLevel
  2864.     )
  2865.    
  2866.     -- Wait briefly for data to update
  2867.     task.wait(0.3)
  2868.    
  2869.     -- Return true to indicate success
  2870.     return true
  2871. end
  2872.  
  2873. -- Function to toggle auto potion usage
  2874. local function toggleAutoUsePotion()
  2875.     isAutoUsingPotions = not isAutoUsingPotions
  2876.    
  2877.     if isAutoUsingPotions then
  2878.         -- Start a new thread for continuous potion checking
  2879.         autoUsingPotionsThread = spawn(function()
  2880.             while isAutoUsingPotions do
  2881.                 -- Only process potions if auto hatching is enabled AND not temporarily disabled
  2882.                 if isAutoHatching and not tempDisableHatching then
  2883.                     -- First handle regular priority potions
  2884.                     for _, potionType in ipairs(priorityPotions) do
  2885.                         -- Check with fresh data if potion is active
  2886.                         if not isPotionActive(potionType) then
  2887.                             -- Get highest level potion with fresh data
  2888.                             local bestPotion = getHighestLevelPotion(potionType)
  2889.                            
  2890.                             -- If we found a potion, use it
  2891.                             if bestPotion then
  2892.                                 usePotion(bestPotion.Name, bestPotion.Level)
  2893.                                 -- Wait a bit between using different potions
  2894.                                 task.wait(1)
  2895.                             end
  2896.                         end
  2897.                     end
  2898.                    
  2899.                     -- Check for Infinity Elixir only when hatching x25 egg
  2900.                     if isHatchingX25Egg and not isPotionActive("Infinity Elixir") then
  2901.                         local infinityPotion = getHighestLevelPotion("Infinity Elixir")
  2902.                         if infinityPotion then
  2903.                             usePotion(infinityPotion.Name, infinityPotion.Level)
  2904.                             task.wait(1)
  2905.                         end
  2906.                     end
  2907.                 end
  2908.                
  2909.                 -- Wait before checking again
  2910.                 task.wait(3) -- Check potions every 3 seconds
  2911.             end
  2912.         end)
  2913.     end
  2914.    
  2915.     return isAutoUsingPotions
  2916. end
  2917.  
  2918. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Auto Collection Buffs Function โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  2919.  
  2920. -- Function to check and use buffs during coin collection
  2921. local function useCollectionBuffs()
  2922.     -- Get fresh data
  2923.     local freshData = LocalDataService:Get()
  2924.    
  2925.     -- Check if Coins potion is active
  2926.     local hasCoinsPotion = false
  2927.     if freshData.ActivePotions and type(freshData.ActivePotions) == "table" then
  2928.         if freshData.ActivePotions["Coins"] and freshData.ActivePotions["Coins"].Active then
  2929.             hasCoinsPotion = true
  2930.         end
  2931.     end
  2932.    
  2933.     -- Check if GoldRush buff is active
  2934.     local hasGoldRush = false
  2935.     if freshData.ActiveBuffs and type(freshData.ActiveBuffs) == "table" then
  2936.         for _, buff in ipairs(freshData.ActiveBuffs) do
  2937.             if buff.Name == "GoldRush" then
  2938.                 hasGoldRush = true
  2939.                 break
  2940.             end
  2941.         end
  2942.     end
  2943.    
  2944.     -- Use Coins potion if not active and we have one
  2945.     if not hasCoinsPotion then
  2946.         local coinsPotion = getHighestLevelPotion("Coins")
  2947.         if coinsPotion then
  2948.             usePotion(coinsPotion.Name, coinsPotion.Level)
  2949.             task.wait(0.5)
  2950.         end
  2951.     end
  2952.    
  2953.     -- Use Golden Orb if GoldRush not active and we have some
  2954.     if not hasGoldRush and freshData.Powerups and freshData.Powerups["Golden Orb"] and freshData.Powerups["Golden Orb"] > 0 then
  2955.         game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("UseGoldenOrb")
  2956.         task.wait(0.5)
  2957.     end
  2958. end
  2959.  
  2960. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Auto Collect Pickup โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  2961.  
  2962. local function toggleAutoCollectPickups()
  2963.     isAutoCollectingPickups = not isAutoCollectingPickups
  2964.    
  2965.     if isAutoCollectingPickups then
  2966.         -- Start a new thread for continuous pickup collection
  2967.         autoCollectingPickupsThread = spawn(function()
  2968.             while isAutoCollectingPickups do
  2969.                 -- Use pcall for error handling
  2970.                 pcall(function()
  2971.                     -- First, check and use collection buffs
  2972.                     useCollectionBuffs()
  2973.                    
  2974.                     local player = game:GetService("Players").LocalPlayer
  2975.                     local character = player.Character
  2976.                     if character then
  2977.                         local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
  2978.                         if humanoidRootPart then
  2979.                             local isInZen = math.abs(humanoidRootPart.Position.Y - 15975) < 30
  2980.                            
  2981.                             -- Only collect if in Zen Island
  2982.                             if isInZen then
  2983.                                 -- Loop through all Chunker folders in Rendered
  2984.                                 for _, chunkerFolder in pairs(workspace.Rendered:GetChildren()) do
  2985.                                     if chunkerFolder.Name == "Chunker" and chunkerFolder:IsA("Folder") then
  2986.                                         -- Loop through each UUID object
  2987.                                         for _, uuidObject in pairs(chunkerFolder:GetChildren()) do
  2988.                                             -- Check if it's a UUID-like name (contains hyphens)
  2989.                                             if typeof(uuidObject) == "Instance" and uuidObject.Name:match("%-") then
  2990.                                                 -- This UUID object is the pickup itself
  2991.                                                 local pickupId = uuidObject.Name
  2992.                                                 game:GetService("ReplicatedStorage").Remotes.Pickups.CollectPickup:FireServer(pickupId)
  2993.                                                 task.wait(0.05)
  2994.                                                 uuidObject:Destroy()
  2995.                                                 task.wait(0.05)
  2996.                                             end
  2997.                                         end
  2998.                                     end
  2999.                                 end
  3000.                             else
  3001.                                 -- Not in Zen, teleport there
  3002.                                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("Teleport", "Workspace.Worlds.The Overworld.Islands.Zen.Island.Portal.Spawn")
  3003.                                 task.wait(5) -- Wait for teleport to complete
  3004.                             end
  3005.                         end
  3006.                     end
  3007.                 end)
  3008.                
  3009.                 -- Wait before checking again
  3010.                 task.wait(1)
  3011.             end
  3012.         end)
  3013.     end
  3014.    
  3015.     return isAutoCollectingPickups
  3016. end
  3017.  
  3018. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Egg Counter Function โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  3019.  
  3020. local function toggleEggCounter()
  3021.     isEggCounterEnabled = not isEggCounterEnabled
  3022.    
  3023.     if isEggCounterEnabled then
  3024.         -- Create GUI if not exists
  3025.         if not EggCounterGui then
  3026.  
  3027.             EggCounterGui = Instance.new("ScreenGui")
  3028.             EggCounterGui.Name = "EggCounterGui"
  3029.             EggCounterGui.ResetOnSpawn = false
  3030.             EggCounterGui.IgnoreGuiInset = true
  3031.             EggCounterGui.DisplayOrder = 98
  3032.            
  3033.             -- Create fully black background covering the entire screen
  3034.             local frame = Instance.new("Frame")
  3035.             frame.Size = UDim2.new(1, 0, 1, 0)  -- Full screen size
  3036.             frame.Position = UDim2.new(0, 0, 0, 0)  -- Starting from top-left corner
  3037.             frame.BackgroundColor3 = Color3.fromRGB(0, 0, 0) -- Black
  3038.             frame.BackgroundTransparency = 0 -- Black Transparancy
  3039.             frame.BorderSizePixel = 0
  3040.             frame.Name = "Frame"
  3041.             frame.Parent = EggCounterGui
  3042.            
  3043.             -- Title label
  3044.             local titleLabel = Instance.new("TextLabel")
  3045.             titleLabel.Size = UDim2.new(1, 0, 0, 50)
  3046.             titleLabel.Position = UDim2.new(0, 0, 0.23, 0)  -- Moved up to 30% down
  3047.             titleLabel.BackgroundTransparency = 1
  3048.             titleLabel.Font = Enum.Font.SourceSansBold
  3049.             titleLabel.TextSize = 135  -- Larger text size
  3050.             titleLabel.TextColor3 = Color3.fromRGB(255, 0, 0) -- Red text initially
  3051.             titleLabel.Text = "Hatching Off"
  3052.             titleLabel.TextStrokeTransparency = 0
  3053.             titleLabel.TextStrokeColor3 = Color3.fromRGB(0, 0, 0)
  3054.             titleLabel.Name = "TitleLabel"
  3055.             titleLabel.Parent = frame
  3056.            
  3057.             -- Egg counter label
  3058.             local counterLabel = Instance.new("TextLabel")
  3059.             counterLabel.Size = UDim2.new(1, 0, 0, 50)
  3060.             counterLabel.Position = UDim2.new(0, 0, 0.37, 0)  -- Moved up to 40% down
  3061.             counterLabel.BackgroundTransparency = 1
  3062.             counterLabel.Font = Enum.Font.SourceSansBold
  3063.             counterLabel.TextSize = 125
  3064.             counterLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  3065.             counterLabel.Text = ""
  3066.             counterLabel.TextWrapped = true
  3067.             counterLabel.TextXAlignment = Enum.TextXAlignment.Center
  3068.             counterLabel.TextStrokeTransparency = 0
  3069.             counterLabel.TextStrokeColor3 = Color3.fromRGB(0, 0, 0)
  3070.             counterLabel.Name = "CounterLabel"
  3071.             counterLabel.Parent = frame
  3072.            
  3073.             -- Coins counter label
  3074.             local coinsLabel = Instance.new("TextLabel")
  3075.             coinsLabel.Size = UDim2.new(1, 0, 0, 50)
  3076.             coinsLabel.Position = UDim2.new(0, 0, 0.52, 0)  -- At 50% down
  3077.             coinsLabel.BackgroundTransparency = 1
  3078.             coinsLabel.Font = Enum.Font.SourceSansBold
  3079.             coinsLabel.TextSize = 125
  3080.             coinsLabel.TextColor3 = Color3.fromRGB(255, 215, 0)  -- Gold color for coins
  3081.             coinsLabel.Text = "Coins: 0"
  3082.             coinsLabel.TextWrapped = true
  3083.             coinsLabel.TextXAlignment = Enum.TextXAlignment.Center
  3084.             coinsLabel.TextStrokeTransparency = 0
  3085.             coinsLabel.TextStrokeColor3 = Color3.fromRGB(0, 0, 0)
  3086.             coinsLabel.Name = "CoinsLabel"
  3087.             coinsLabel.Parent = frame
  3088.            
  3089.             -- Gems counter label
  3090.             local gemsLabel = Instance.new("TextLabel")
  3091.             gemsLabel.Size = UDim2.new(1, 0, 0, 50)
  3092.             gemsLabel.Position = UDim2.new(0, 0, 0.65, 0)  -- At 60% down
  3093.             gemsLabel.BackgroundTransparency = 1
  3094.             gemsLabel.Font = Enum.Font.SourceSansBold
  3095.             gemsLabel.TextSize = 125
  3096.             gemsLabel.TextColor3 = Color3.fromRGB(170, 0, 255)  -- Purple color for gems
  3097.             gemsLabel.Text = "Gems: 0"
  3098.             gemsLabel.TextWrapped = true
  3099.             gemsLabel.TextXAlignment = Enum.TextXAlignment.Center
  3100.             gemsLabel.TextStrokeTransparency = 0
  3101.             gemsLabel.TextStrokeColor3 = Color3.fromRGB(0, 0, 0)
  3102.             gemsLabel.Name = "GemsLabel"
  3103.             gemsLabel.Parent = frame
  3104.            
  3105.             EggCounterGui.Parent = game:GetService("CoreGui")
  3106.         else
  3107.             EggCounterGui.Enabled = true
  3108.         end
  3109.        
  3110.         -- Start updating the counter in a loop
  3111.         spawn(function()
  3112.             while isEggCounterEnabled and EggCounterGui do
  3113.                 local playerData = LocalDataService:Get()
  3114.                 local titleLabel = EggCounterGui.Frame.TitleLabel
  3115.                 local counterLabel = EggCounterGui.Frame.CounterLabel
  3116.                 local coinsLabel = EggCounterGui.Frame.CoinsLabel
  3117.                 local gemsLabel = EggCounterGui.Frame.GemsLabel
  3118.                
  3119.                 -- Update coins and gems regardless of hatching state
  3120.                 if playerData then
  3121.                     -- Update coins (using your existing GetCurrentCoins function)
  3122.                     local currentCoins = GetCurrentCoins()
  3123.                     coinsLabel.Text = "Coins: " .. FormatNumberCompact(currentCoins)
  3124.                    
  3125.                     -- Update gems
  3126.                     local currentGems = playerData.Gems or 0
  3127.                     gemsLabel.Text = "Gems: " .. FormatNumberCompact(currentGems)
  3128.                 end
  3129.                
  3130.                 if CurrentlyHatchingEgg and playerData and playerData.EggsOpened then
  3131.                     local eggCount = playerData.EggsOpened[CurrentlyHatchingEgg] or 0
  3132.                     titleLabel.Text = "Currently Hatching"
  3133.                     titleLabel.TextColor3 = Color3.fromRGB(0, 255, 0) -- Green
  3134.                     counterLabel.Text = CurrentlyHatchingEgg .. " : " .. tostring(eggCount)
  3135.                 else
  3136.                     titleLabel.Text = "Hatching Off"
  3137.                     titleLabel.TextColor3 = Color3.fromRGB(255, 0, 0) -- Red
  3138.                     counterLabel.Text = ""
  3139.                 end
  3140.                
  3141.                 task.wait(1)
  3142.                
  3143.                 -- Break the loop if toggle is turned off
  3144.                 if not isEggCounterEnabled then break end
  3145.             end
  3146.         end)
  3147.     else
  3148.         -- Hide the GUI when toggled off
  3149.         if EggCounterGui then
  3150.             EggCounterGui.Enabled = false
  3151.         end
  3152.     end
  3153.    
  3154.     return isEggCounterEnabled
  3155. end
  3156.  
  3157. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Auto Hatch Function โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  3158.  
  3159. -- Function to extract luck multiplier from text (e.g. "x5", "x10")
  3160. local function getLuckMultiplier(luckText)
  3161.     if not luckText then return 0 end
  3162.    
  3163.     -- Extract number after 'x'
  3164.     local multiplier = luckText:match("x(%d+)")
  3165.     if multiplier then
  3166.         return tonumber(multiplier) or 0
  3167.     end
  3168.     return 0
  3169. end
  3170.  
  3171. -- Inside findBestEgg function
  3172. local function findBestEgg()
  3173.     local rifts = workspace.Rendered:FindFirstChild("Rifts")
  3174.     if not rifts then return nil end
  3175.    
  3176.     -- Store all available eggs with their priority and luck multiplier
  3177.     local availableEggs = {}
  3178.    
  3179.     -- Check all eggs and get their priority and luck info
  3180.     for _, eggId in ipairs(eggPriority) do
  3181.         local egg = rifts:FindFirstChild(eggId)
  3182.         if egg then
  3183.             local display = egg:FindFirstChild("Display")
  3184.             if display then
  3185.                 -- Find the luck text if it exists
  3186.                 local luckMultiplier = 0
  3187.                 for _, descendant in ipairs(egg:GetDescendants()) do
  3188.                     if descendant.Name == "Luck" and descendant:IsA("TextLabel") and descendant.Text then
  3189.                         luckMultiplier = getLuckMultiplier(descendant.Text)
  3190.                         break
  3191.                     end
  3192.                 end
  3193.                
  3194.                 -- Store egg with priority index and luck multiplier
  3195.                 table.insert(availableEggs, {
  3196.                     eggId = eggId,
  3197.                     eggName = eggMapping[eggId],
  3198.                     display = display,
  3199.                     priority = table.find(eggPriority, eggId) or #eggPriority + 1,
  3200.                     luckMultiplier = luckMultiplier
  3201.                 })
  3202.             end
  3203.         end
  3204.     end
  3205.    
  3206.     -- Sort eggs by x25 first, then by priority, then by luck multiplier
  3207.     table.sort(availableEggs, function(a, b)
  3208.         -- Always prioritize x25 eggs over anything else
  3209.         if a.luckMultiplier == 25 and b.luckMultiplier ~= 25 then
  3210.             return true
  3211.         elseif a.luckMultiplier ~= 25 and b.luckMultiplier == 25 then
  3212.             return false
  3213.         -- If both are x25 or neither is x25, fall back to normal priority
  3214.         elseif a.priority == b.priority then
  3215.             -- Higher luck multiplier comes first
  3216.             return a.luckMultiplier > b.luckMultiplier
  3217.         end
  3218.         -- Lower priority index comes first (higher priority)
  3219.         return a.priority < b.priority
  3220.     end)
  3221.    
  3222.     -- Get the best egg
  3223.     local bestEgg = #availableEggs > 0 and availableEggs[1] or nil
  3224.    
  3225.     -- Set the flag for x25 egg if found
  3226.     isHatchingX25Egg = bestEgg and bestEgg.luckMultiplier == 25 or false
  3227.    
  3228.     -- Return the best egg or nil if none found
  3229.     return bestEgg
  3230. end
  3231.  
  3232. -- Function to check if we're near the egg
  3233. local function isNearEgg(eggDisplay)
  3234.     if not eggDisplay then return false end
  3235.    
  3236.     local player = game:GetService("Players").LocalPlayer
  3237.     local character = player.Character
  3238.     if not character then return false end
  3239.    
  3240.     local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
  3241.     if not humanoidRootPart then return false end
  3242.    
  3243.     -- Check if we're within 10 studs of the egg
  3244.     local distance = (humanoidRootPart.Position - eggDisplay.Position).Magnitude
  3245.     return distance < 15
  3246. end
  3247.  
  3248. local function toggleAutoHatch()
  3249.     -- Only allow toggling on if mastery requirements are met
  3250.     if not isAutoHatching and not (PetsMasteryCompleted and BuffsMasteryCompleted) then
  3251.         -- Skip activation if mastery is not completed yet
  3252.         return false
  3253.     end
  3254.    
  3255.     isAutoHatching = not isAutoHatching
  3256.    
  3257.     if isAutoHatching then
  3258.         -- If auto potions not active yet, start it
  3259.         if not isAutoUsingPotions then
  3260.             toggleAutoUsePotion()
  3261.         end
  3262.        
  3263.         -- Start a new thread for continuous hatching
  3264.         autoHatchingThread = spawn(function()
  3265.             while isAutoHatching do
  3266.                 -- Use pcall for error handling
  3267.                 pcall(function()
  3268.                     -- Check coin levels
  3269.                     local currentCoins = GetCurrentCoins()
  3270.                    
  3271.                     -- If coins are below the low threshold, switch to pickup collection
  3272.                     if currentCoins < Low_Coins then
  3273.                         -- Enable pickup collection if not already collecting
  3274.                         if not isAutoCollectingPickups then
  3275.                             toggleAutoCollectPickups()
  3276.                             pickupCollectionStartedByHatcher = true
  3277.                             tempDisableHatching = true
  3278.                         end
  3279.                         task.wait(3) -- Wait before checking again
  3280.                         return
  3281.                     else
  3282.                         -- Only disable collection and resume hatching if we've reached the target (60% of max)
  3283.                         if currentCoins >= Max_Coins * 0.6 then
  3284.                             -- Re-enable hatching
  3285.                             tempDisableHatching = false
  3286.                            
  3287.                             -- Disable pickup collection if it was enabled by us
  3288.                             if isAutoCollectingPickups and pickupCollectionStartedByHatcher then
  3289.                                 toggleAutoCollectPickups()
  3290.                                 pickupCollectionStartedByHatcher = false
  3291.                             end
  3292.                         else
  3293.                             -- We're between Low_Coins and 60% target, keep collecting if already started
  3294.                             if isAutoCollectingPickups and pickupCollectionStartedByHatcher then
  3295.                                 -- Continue collecting
  3296.                                 task.wait(3)
  3297.                                 return
  3298.                             else
  3299.                                 -- No collection active, but we're between thresholds
  3300.                                 -- Clear temp disable so we can hatch until low again
  3301.                                 tempDisableHatching = false
  3302.                             end
  3303.                         end
  3304.                     end
  3305.                    
  3306.                     -- Only proceed with hatching if not temporarily disabled
  3307.                     if not tempDisableHatching then
  3308.                         -- Check if we're near Max_Coins - prioritize hatching
  3309.                         local shouldPrioritizeHatching = currentCoins >= Max_Coins * 0.95
  3310.                        
  3311.                         -- Find the best egg to hatch
  3312.                         local bestEgg = findBestEgg()
  3313.                        
  3314.                         -- If no eggs found, use Default_Egg
  3315.                         if not bestEgg then
  3316.                             -- Check if we're already near Default_Egg position by Y coordinate
  3317.                             local player = game:GetService("Players").LocalPlayer
  3318.                             local character = player.Character
  3319.                             if character then
  3320.                                 local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
  3321.                                 if humanoidRootPart then
  3322.                                     local playerPos = humanoidRootPart.Position
  3323.                                     local defaultEggY = Default_Egg.Position.Y - 7  -- Account for the -7 offset
  3324.                                    
  3325.                                     -- Only tween if we're not already near Default_Egg
  3326.                                     if math.abs(playerPos.Y - defaultEggY) > 10 then
  3327.                                         -- Create adjusted CFrame below Default_Egg
  3328.                                         local adjustedCFrame = Default_Egg * CFrame.new(0, -7, 0)
  3329.                                        
  3330.                                         -- Use adjusted CFrame for tweening
  3331.                                         local horizTween, vertTween = TweenCharacterToTarget(adjustedCFrame)
  3332.                                        
  3333.                                         -- Wait for the tween to complete
  3334.                                         if horizTween and vertTween then
  3335.                                             horizTween.Completed:Wait()
  3336.                                             vertTween.Completed:Wait()
  3337.                                         else
  3338.                                             task.wait(0.5) -- Reduced wait time
  3339.                                         end
  3340.                                     end
  3341.                                 end
  3342.                             end
  3343.                            
  3344.                             -- Try hatching at the default location
  3345.                             local hatchAmount = 8
  3346.                             CurrentlyHatchingEgg = "100M Egg"
  3347.                             game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer(
  3348.                                 "HatchEgg",
  3349.                                 "100M Egg", -- Assuming a default egg name, adjust as needed
  3350.                                 hatchAmount
  3351.                             )
  3352.                            
  3353.                             -- Press R key to skip egg opening
  3354.                             task.wait(0.05) -- Reduced wait time
  3355.                             VIM:SendKeyEvent(true, Enum.KeyCode.R, false, game)
  3356.                             task.wait(0.05) -- Reduced wait time
  3357.                             VIM:SendKeyEvent(false, Enum.KeyCode.R, false, game)
  3358.                            
  3359.                             task.wait(0.5) -- Reduced wait time
  3360.                         elseif currentCoins >= Low_Coins then
  3361.                             -- Use our tween function to move to the egg
  3362.                             local horizTween, vertTween = TweenCharacterToTarget(bestEgg.display)
  3363.                            
  3364.                             -- Wait for the tween to complete
  3365.                             if horizTween and vertTween then
  3366.                                 horizTween.Completed:Wait()
  3367.                                 vertTween.Completed:Wait()
  3368.                             else
  3369.                                 task.wait(0.5) -- Reduced wait time
  3370.                             end
  3371.                            
  3372.                             -- Start hatching eggs (8 at a time)
  3373.                             local hatchAmount = 8
  3374.                            
  3375.                             -- Only try to hatch if we're near the egg
  3376.                             while GetCurrentCoins() >= Low_Coins do
  3377.                                 -- Recheck for the best egg every time
  3378.                                 local newBestEgg = findBestEgg()
  3379.                                
  3380.                                 -- If no eggs available anymore, break out completely
  3381.                                 if not newBestEgg then
  3382.                                     -- No eggs available at all, break and wait for next cycle
  3383.                                     break
  3384.                                 elseif newBestEgg.eggId ~= bestEgg.eggId then
  3385.                                     -- A different (possibly better) egg is available - update and move to it
  3386.                                     bestEgg = newBestEgg
  3387.                                    
  3388.                                     -- Move to the new best egg
  3389.                                     local newHorizTween, newVertTween = TweenCharacterToTarget(bestEgg.display)
  3390.                                     if newHorizTween and newVertTween then
  3391.                                         newHorizTween.Completed:Wait()
  3392.                                         newVertTween.Completed:Wait()
  3393.                                     else
  3394.                                         task.wait(0.5) -- Reduced wait time
  3395.                                     end
  3396.                                 end
  3397.                                
  3398.                                 -- Make sure we're near the egg before hatching
  3399.                                 if isNearEgg(bestEgg.display) then
  3400.                                     -- Hatch the egg
  3401.                                     CurrentlyHatchingEgg = bestEgg.eggName
  3402.                                     game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer(
  3403.                                         "HatchEgg",
  3404.                                         bestEgg.eggName,
  3405.                                         hatchAmount
  3406.                                     )
  3407.                                    
  3408.                                     -- Press R key to skip egg opening
  3409.                                     task.wait(0.05) -- Reduced wait time
  3410.                                     VIM:SendKeyEvent(true, Enum.KeyCode.R, false, game)
  3411.                                     task.wait(0.05) -- Reduced wait time
  3412.                                     VIM:SendKeyEvent(false, Enum.KeyCode.R, false, game)
  3413.                                    
  3414.                                     -- Wait a bit between hatches
  3415.                                     task.wait(0.5) -- Reduced wait time
  3416.                                    
  3417.                                     -- If coins go too low, break early
  3418.                                     if GetCurrentCoins() < Low_Coins * 1.1 then
  3419.                                         break
  3420.                                     end
  3421.                                 else
  3422.                                     -- We've lost proximity to the egg, need to recheck
  3423.                                     break
  3424.                                 end
  3425.                             end
  3426.                         end
  3427.                     end
  3428.                 end)
  3429.                
  3430.                 -- Wait before checking again
  3431.                 task.wait(0.5) -- Reduced wait time for responsiveness
  3432.             end
  3433.         end)
  3434.     else
  3435.         -- If we're turning off auto hatching, also turn off auto potions
  3436.         if isAutoUsingPotions then
  3437.             toggleAutoUsePotion()
  3438.         end
  3439.        
  3440.         -- If we're turning off auto hatching, also turn off pickup collection if we started it
  3441.         if isAutoCollectingPickups and pickupCollectionStartedByHatcher then
  3442.             toggleAutoCollectPickups()
  3443.             pickupCollectionStartedByHatcher = false
  3444.         end
  3445.     end
  3446.    
  3447.     return isAutoHatching
  3448. end
  3449.  
  3450. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Auto Bubble & Sell Function โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  3451.  
  3452. local function Auto_Bubble_And_Sell()
  3453.     -- Only activate if we haven't met all the completion conditions
  3454.     if Auto_Bubble_And_Sell_Active or
  3455.        (AllMasteryCompleted and max_Upgrades_Reached) or
  3456.        isAutoHatching then
  3457.         -- If already running, everything complete, or hatching is active, turn off
  3458.         Auto_Bubble_And_Sell_Active = false
  3459.         return false
  3460.     end
  3461.    
  3462.     Auto_Bubble_And_Sell_Active = true
  3463.    
  3464.     -- Start a new thread for continuous bubble blowing and selling/collecting
  3465.     Auto_Bubble_And_Sell_Thread = spawn(function()
  3466.         while Auto_Bubble_And_Sell_Active do
  3467.             -- Always blow bubbles regardless of location
  3468.             game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("BlowBubble")
  3469.            
  3470.             -- Stop if auto hatching started or all tasks completed
  3471.             if isAutoHatching or (AllMasteryCompleted and max_Upgrades_Reached) then
  3472.                 Auto_Bubble_And_Sell_Active = false
  3473.                 break
  3474.             end
  3475.            
  3476.             -- First, always check and use buffs regardless of location
  3477.             pcall(function()
  3478.                 -- Get fresh data
  3479.                 local freshData = LocalDataService:Get()
  3480.                
  3481.                 -- Check if Coins potion is active
  3482.                 local hasCoinsPotion = false
  3483.                 if freshData.ActivePotions and type(freshData.ActivePotions) == "table" then
  3484.                     if freshData.ActivePotions["Coins"] and freshData.ActivePotions["Coins"].Active then
  3485.                         hasCoinsPotion = true
  3486.                     end
  3487.                 end
  3488.                
  3489.                 -- Check if GoldRush buff is active
  3490.                 local hasGoldRush = false
  3491.                 if freshData.ActiveBuffs and type(freshData.ActiveBuffs) == "table" then
  3492.                     for _, buff in ipairs(freshData.ActiveBuffs) do
  3493.                         if buff.Name == "GoldRush" then
  3494.                             hasGoldRush = true
  3495.                             break
  3496.                         end
  3497.                     end
  3498.                 end
  3499.                
  3500.                 -- Use Coins potion if not active and we have one
  3501.                 if not hasCoinsPotion then
  3502.                     local coinsPotion = getHighestLevelPotion("Coins")
  3503.                     if coinsPotion then
  3504.                         usePotion(coinsPotion.Name, coinsPotion.Level)
  3505.                         task.wait(0.5)
  3506.                     end
  3507.                 end
  3508.                
  3509.                 -- Use Golden Orb if GoldRush not active and we have some
  3510.                 if not hasGoldRush and freshData.Powerups and freshData.Powerups["Golden Orb"] and freshData.Powerups["Golden Orb"] > 0 then
  3511.                     game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("UseGoldenOrb")
  3512.                     task.wait(0.5)
  3513.                 end
  3514.             end)
  3515.            
  3516.             -- Decide mode: Zen pickup collection OR Twilight bubble selling
  3517.             if max_Flavor_Reached and
  3518.                (not PetsMasteryCompleted or not BuffsMasteryCompleted or not ShopsMasteryCompleted) then
  3519.                 -- PICKUP COLLECTION MODE: Switch to Zen pickup collection for gems
  3520.                 if not isAutoCollectingPickups then
  3521.                     toggleAutoCollectPickups() -- This will handle teleporting to Zen
  3522.                     task.wait(3) -- Give time for teleport
  3523.                 end
  3524.                
  3525.                 -- Don't attempt to sell bubbles in this mode (we're in Zen)
  3526.             else
  3527.                 -- BUBBLE SELLING MODE: Turn off pickup collection if active
  3528.                 if isAutoCollectingPickups then
  3529.                     toggleAutoCollectPickups()
  3530.                     task.wait(1)
  3531.                 end
  3532.                
  3533.                 -- Only attempt selling bubbles when we're in selling mode
  3534.                 pcall(function()
  3535.                     -- Get player and character
  3536.                     local player = game:GetService("Players").LocalPlayer
  3537.                     local character = player.Character
  3538.                    
  3539.                     if character then
  3540.                         local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
  3541.                         if humanoidRootPart then
  3542.                             local playerPos = humanoidRootPart.Position
  3543.                            
  3544.                             -- Check if player is NOT in Twilight area (Y position ~6862)
  3545.                             if math.abs(playerPos.Y - 6862) > 30 then
  3546.                                 -- Player is not at the right location, teleport there
  3547.                                 game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer(
  3548.                                     "Teleport",
  3549.                                     "Workspace.Worlds.The Overworld.Islands.Twilight.Island.Portal.Spawn"
  3550.                                 )
  3551.                                 task.wait(2) -- Longer wait after teleport
  3552.                             else
  3553.                                 -- Player is at the right Y level, tween to the sell area
  3554.                                 local sellRoot = workspace.Worlds["The Overworld"].Islands.Twilight.Island.Sell.Root
  3555.                                 if sellRoot then
  3556.                                     -- Check if already near the sell root
  3557.                                     local distance = (humanoidRootPart.Position - sellRoot.Position).Magnitude
  3558.                                     if distance > 10 then
  3559.                                         -- Tween to the sell area
  3560.                                         local horizontalTween, verticalTween = TweenCharacterToTarget(sellRoot)
  3561.                                        
  3562.                                         -- Wait for tweens to complete
  3563.                                         if horizontalTween then
  3564.                                             horizontalTween.Completed:Wait()
  3565.                                         end
  3566.                                        
  3567.                                         if verticalTween then
  3568.                                             verticalTween.Completed:Wait()
  3569.                                         end
  3570.                                        
  3571.                                         task.wait(0.5) -- Wait after tweening
  3572.                                     end
  3573.                                    
  3574.                                     -- Check bubble count after reaching sell area
  3575.                                     local GuiGum = player.PlayerGui.ScreenGui.HUD.Left.Currency.Bubble.Frame.Label.Text
  3576.                                     local current, max = extractNumbers(GuiGum)
  3577.                                    
  3578.                                     -- Sell bubbles if we have any
  3579.                                     if current and current > 1 then
  3580.                                         game:GetService("ReplicatedStorage").Shared.Framework.Network.Remote.Event:FireServer("SellBubble")
  3581.                                         task.wait(0.5) -- Wait after selling
  3582.                                     end
  3583.                                 end
  3584.                             end
  3585.                         end
  3586.                     end
  3587.                 end)
  3588.             end
  3589.            
  3590.             -- Check if all tasks completed
  3591.             if (AllMasteryCompleted and max_Upgrades_Reached) or isAutoHatching then
  3592.                 Auto_Bubble_And_Sell_Active = false
  3593.                
  3594.                 -- Turn off pickup collection if it's on
  3595.                 if isAutoCollectingPickups then
  3596.                     toggleAutoCollectPickups()
  3597.                 end
  3598.                
  3599.                 break
  3600.             end
  3601.            
  3602.             -- Wait a small amount between cycles
  3603.             task.wait(0.3)
  3604.         end
  3605.     end)
  3606.    
  3607.     return Auto_Bubble_And_Sell_Active
  3608. end
  3609.  
  3610.  
  3611. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Initialize Data Function โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  3612.  
  3613. local function InitializePlayerData()
  3614.     -- Get fresh player data
  3615.     local freshData = LocalDataService:Get()
  3616.    
  3617.     -- Initialize all status flags based on current data
  3618.     if freshData then
  3619.         -- 1. Check flavor and gum upgrade status
  3620.         if freshData.Flavors then
  3621.             -- Get the highest price flavor to check if we've reached max flavor
  3622.             local max_flavor_item = get_Highest_Priced_Item(flavorsConfig)
  3623.             if freshData.Flavors[max_flavor_item] then
  3624.                 max_Flavor_Reached = true
  3625.             else
  3626.                 max_Flavor_Reached = false
  3627.             end
  3628.         else
  3629.             max_Flavor_Reached = false
  3630.         end
  3631.        
  3632.         if freshData.Gum then
  3633.             -- Get the highest price gum to check if we've reached max gum
  3634.             local max_gum_item = get_Highest_Priced_Item(gumConfig)
  3635.             if freshData.Gum[max_gum_item] then
  3636.                 max_Gum_Reached = true
  3637.             else
  3638.                 max_Gum_Reached = false
  3639.             end
  3640.         else
  3641.             max_Gum_Reached = false
  3642.         end
  3643.        
  3644.         max_Upgrades_Reached = max_Flavor_Reached and max_Gum_Reached
  3645.        
  3646.         -- 2. Check mastery completion status
  3647.         -- Function to check if mastery is completed based on available targets
  3648.         local function checkMasteryCompleted(masteryTargets)
  3649.             if not masteryTargets or #masteryTargets == 0 then
  3650.                 return true -- No targets means mastery is completed
  3651.             end
  3652.             return false
  3653.         end
  3654.        
  3655.         -- Use FindAvailableAndMastery to update mastery targets
  3656.         FindAvailableAndMastery()
  3657.        
  3658.         -- Set completion flags based on target counts
  3659.         PetsMasteryCompleted = checkMasteryCompleted(Mastery_Pets_Targets)
  3660.         BuffsMasteryCompleted = checkMasteryCompleted(Mastery_Buffs_Targets)
  3661.         ShopsMasteryCompleted = checkMasteryCompleted(Mastery_Shops_Targets)
  3662.        
  3663.         -- Update combined mastery flag
  3664.         AllMasteryCompleted = PetsMasteryCompleted and BuffsMasteryCompleted and ShopsMasteryCompleted
  3665.        
  3666.         return true
  3667.     end
  3668.    
  3669.     return false
  3670. end
  3671.  
  3672. -- ๐ŸŒ€โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” Main Loop โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”๐ŸŒ€
  3673.  
  3674. while true do
  3675.     -- Use pcall for the entire loop body to prevent script crashes
  3676.     local success, errorMsg = pcall(function()
  3677.  
  3678.         -- Handle intro once at the beginning
  3679.         if not hasHandledIntro then
  3680.             hasHandledIntro = handleIntro()
  3681.             if hasHandledIntro then
  3682.                 -- Wait longer after handling the intro to ensure everything loads properly
  3683.                 task.wait(5)
  3684.                 InitializePlayerData()
  3685.                 task.wait(10)
  3686.             end
  3687.         end
  3688.  
  3689.         -- First unlock areas and enable fly mode (basic setup)
  3690.         if not AreaUnlock_Toggle and not areasUnlocked then
  3691.             areasUnlocked = UnlockAreas()
  3692.         end
  3693.  
  3694.         if not isFlyModeActive then
  3695.             toggleFlyMode()
  3696.         end
  3697.  
  3698.         -- Check and update mastery progress
  3699.         if not isAutoMastery then
  3700.             FindAvailableAndMastery()
  3701.         end
  3702.  
  3703.         -- Bubble and sell OR hatch eggs based on mastery progress
  3704.         if PetsMasteryCompleted and BuffsMasteryCompleted then
  3705.             -- Mastery complete - focus on hatching
  3706.             if not isAutoHatching then
  3707.                 toggleAutoHatch()
  3708.             elseif isAutoHatching and not isAutoUsingPotions then
  3709.                 -- Make sure potions are enabled when hatching is active
  3710.                 toggleAutoUsePotion()
  3711.             end
  3712.         else
  3713.             -- Mastery not complete - focus on bubble selling
  3714.             if not Auto_Bubble_And_Sell_Active and not isAutoHatching then
  3715.                 Auto_Bubble_And_Sell()
  3716.             end
  3717.         end
  3718.  
  3719.         -- Always handle pet deletion
  3720.         if not isAutoDeletingPets then
  3721.             toggleAutoPetDeletion()
  3722.         end
  3723.  
  3724.         -- Check for daily rewards
  3725.         if not CheckRewards_Toggle and not hasClaimedDailyReward then
  3726.             hasClaimedDailyReward = checkDailyRewards()
  3727.         end
  3728.  
  3729.         -- Claim playtime rewards
  3730.         if not AutoClaimPlaytime_Toggle and not PlaytimeRewardsClaimed then
  3731.             toggleAutoClaimPlaytime()
  3732.         end
  3733.  
  3734.         -- Apply optimal settings
  3735.         if not SetSettings_Toggle and not settingsApplied then
  3736.             SetOptimalSettings()
  3737.         end
  3738.  
  3739.         -- Claim prizes
  3740.         if not AutoClaimPrizes_Toggle then
  3741.             toggleAutoClaimPrizes()
  3742.         end
  3743.        
  3744.         -- Buy items if not already running and not completed
  3745.         if not AutoBuy_Toggle and not max_Upgrades_Reached then
  3746.             AutoBuy_Toggle, max_Flavor_Reached, max_Gum_Reached, max_Upgrades_Reached = AutoBuyItems()
  3747.         end
  3748.        
  3749.         -- Hide overlays
  3750.         if not AutoHideOverlay_Toggle then
  3751.             toggleAutoHideOverlay()
  3752.         end
  3753.        
  3754.         -- Use mystery boxes
  3755.         if not AutoMysteryBoxes_Toggle then
  3756.             toggleAutoMysteryBoxes()
  3757.         end
  3758.  
  3759.         -- Spin wheel
  3760.         if not AutoWheelSpin_Toggle then
  3761.             toggleAutoWheelSpin()
  3762.         end
  3763.  
  3764.         -- Craft potions
  3765.         if not isAutoCraftingPotions then
  3766.             toggleAutoCraftPotions()
  3767.         end
  3768.  
  3769.         -- Only run reroll enchants if mastery requirements are met
  3770.         if not RerollEnchants_Toggle and (PetsMasteryCompleted and BuffsMasteryCompleted) then
  3771.             RerollEnchants()
  3772.         end
  3773.  
  3774.         if not isPressingB then
  3775.             togglePeriodicB()
  3776.         end    
  3777.  
  3778.         if not isAutoBuyingShopItems then
  3779.             toggleAutoBuyShopItems()
  3780.         end
  3781.  
  3782.         if not SecretPetCheck_Toggle then
  3783.             checkForSecretPets()
  3784.         end
  3785.  
  3786.         if not isEggCounterEnabled then
  3787.             toggleEggCounter()
  3788.         end
  3789.  
  3790.         -- Wait a bit to prevent the game from lagging
  3791.         task.wait(0.2)
  3792.     end)
  3793.    
  3794.     -- Handle any errors that occurred during execution
  3795.     if not success then
  3796.         print("ERROR IN MAIN LOOP: " .. tostring(errorMsg))
  3797.         -- Wait a bit before continuing to prevent error spam
  3798.         task.wait(2)
  3799.     end
  3800.    
  3801.     -- Always have a small wait to prevent infinite loops if the task.wait inside pcall fails
  3802.     task.wait(0.1)
  3803. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement