Guest User

Grow a Garden [Pet Egg ESP]

a guest
Jun 7th, 2025
21,291
-1
Never
6
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.28 KB | None | 0 1
  1. local replicatedStorage = game:GetService("ReplicatedStorage")
  2. local collectionService = game:GetService("CollectionService")
  3. local players = game:GetService("Players")
  4. local runService = game:GetService("RunService")
  5.  
  6. local localPlayer = players.LocalPlayer
  7. local currentCamera = workspace.CurrentCamera
  8.  
  9. local hatchFunction = getupvalue(getupvalue(getconnections(replicatedStorage.GameEvents.PetEggService.OnClientEvent)[1].Function, 1), 2)
  10. local eggModels = getupvalue(hatchFunction, 1)
  11. local eggPets = getupvalue(hatchFunction, 2)
  12.  
  13. local espCache = {}
  14. local activeEggs = {}
  15.  
  16. local function getObjectFromId(objectId)
  17. for eggModel in eggModels do
  18. if eggModel:GetAttribute("OBJECT_UUID") ~= objectId then continue end
  19. return eggModel
  20. end
  21. end
  22.  
  23. local function UpdateEsp(objectId, petName)
  24. local object = getObjectFromId(objectId)
  25. if not object or not espCache[objectId] then return end
  26.  
  27. local eggName = object:GetAttribute("EggName")
  28. espCache[objectId].Text = `{eggName} | {petName}`
  29. end
  30.  
  31. local function AddEsp(object)
  32. if object:GetAttribute("OWNER") ~= localPlayer.Name then return end
  33.  
  34. local eggName = object:GetAttribute("EggName")
  35. local petName = eggPets[object:GetAttribute("OBJECT_UUID")]
  36.  
  37. local objectId = object:GetAttribute("OBJECT_UUID")
  38. if not objectId then return end
  39.  
  40. local label = Drawing.new("Text")
  41. label.Text = `{eggName} | {petName or "?"}`
  42. label.Size = 18
  43. label.Color = Color3.new(1, 1, 1)
  44. label.Outline = true
  45. label.OutlineColor = Color3.new(0, 0, 0)
  46. label.Center = true
  47. label.Visible = false
  48.  
  49. espCache[objectId] = label
  50. activeEggs[objectId] = object
  51. end
  52.  
  53. local function RemoveEsp(object)
  54. if object:GetAttribute("OWNER") ~= localPlayer.Name then return end
  55.  
  56. local objectId = object:GetAttribute("OBJECT_UUID")
  57. if espCache[objectId] then
  58. espCache[objectId]:Remove()
  59. espCache[objectId] = nil
  60. end
  61.  
  62. activeEggs[objectId] = nil
  63. end
  64.  
  65. local function UpdateAllEsp()
  66. for objectId, object in activeEggs do
  67. if not object or not object:IsDescendantOf(workspace) then
  68. activeEggs[objectId] = nil
  69. if espCache[objectId] then
  70. espCache[objectId].Visible = false
  71. end
  72. continue
  73. end
  74.  
  75. local label = espCache[objectId]
  76. if label then
  77. local pos, onScreen = currentCamera:WorldToViewportPoint(object:GetPivot().Position)
  78. if onScreen then
  79. label.Position = Vector2.new(pos.X, pos.Y)
  80. label.Visible = true
  81. else
  82. label.Visible = false
  83. end
  84. end
  85. end
  86. end
  87.  
  88. for _, object in collectionService:GetTagged("PetEggServer") do
  89. task.spawn(AddEsp, object)
  90. end
  91.  
  92. collectionService:GetInstanceAddedSignal("PetEggServer"):Connect(AddEsp)
  93. collectionService:GetInstanceRemovedSignal("PetEggServer"):Connect(RemoveEsp)
  94.  
  95. local old; old = hookfunction(getconnections(replicatedStorage.GameEvents.EggReadyToHatch_RE.OnClientEvent)[1].Function, newcclosure(function(objectId, petName)
  96. UpdateEsp(objectId, petName)
  97. return old(objectId, petName)
  98. end))
  99.  
  100. runService.PreRender:Connect(UpdateAllEsp)
  101. -- // More scripts: t.me/arceusxscripts
Advertisement
Comments
Add Comment
Please, Sign In to add comment