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