iOSdeveloper

Untitled

Jun 10th, 2025
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.02 KB | None | 0 0
  1. local replicatedStorage = game:GetService("ReplicatedStorage")
  2. local collectionService = game:GetService("CollectionService")
  3. local players = game:GetService("Players")
  4.  
  5. local localPlayer = players.LocalPlayer
  6.  
  7. local hatchFunction = getupvalue(getupvalue(getconnections(replicatedStorage.GameEvents.PetEggService.OnClientEvent)[1].Function, 1), 2)
  8. local eggModels = getupvalue(hatchFunction, 1)
  9. local eggPets = getupvalue(hatchFunction, 2)
  10.  
  11. local espCache = {}
  12. local activeEggs = {}
  13.  
  14. local function getObjectFromId(objectId)
  15. for eggModel in eggModels do
  16. if eggModel:GetAttribute("OBJECT_UUID") ~= objectId then continue end
  17. return eggModel
  18. end
  19. end
  20.  
  21. local function CreateEspGui(object, text)
  22. local billboard = Instance.new("BillboardGui")
  23. billboard.Name = "PetEggESP"
  24. billboard.Adornee = object:FindFirstChildWhichIsA("BasePart") or object.PrimaryPart or object
  25. billboard.Size = UDim2.new(0, 200, 0, 50)
  26. billboard.StudsOffset = Vector3.new(0, 2.5, 0)
  27. billboard.AlwaysOnTop = true
  28.  
  29. local label = Instance.new("TextLabel")
  30. label.Name = "TextLabel"
  31. label.Parent = billboard
  32. label.Size = UDim2.new(1, 0, 1, 0)
  33. label.BackgroundTransparency = 1
  34. label.Text = text
  35. label.TextColor3 = Color3.new(1, 1, 1)
  36. label.TextStrokeTransparency = 0
  37. label.TextScaled = true
  38. label.Font = Enum.Font.SourceSansBold
  39.  
  40. local gradient = Instance.new("UIGradient")
  41. gradient.Color = ColorSequence.new({
  42. ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 0, 0)),
  43. ColorSequenceKeypoint.new(0.17, Color3.fromRGB(255, 127, 0)),
  44. ColorSequenceKeypoint.new(0.33, Color3.fromRGB(255, 255, 0)),
  45. ColorSequenceKeypoint.new(0.5, Color3.fromRGB(0, 255, 0)),
  46. ColorSequenceKeypoint.new(0.67, Color3.fromRGB(0, 0, 255)),
  47. ColorSequenceKeypoint.new(0.83, Color3.fromRGB(75, 0, 130)),
  48. ColorSequenceKeypoint.new(1, Color3.fromRGB(148, 0, 211))
  49. })
  50. gradient.Rotation = 0
  51. gradient.Parent = label
  52.  
  53. task.spawn(function()
  54. while true do
  55. local tween = game:GetService("TweenService"):Create(gradient, TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut), {Rotation = gradient.Rotation + 360})
  56. tween:Play()
  57. tween.Completed:Wait()
  58. gradient.Rotation = 0
  59. end
  60. end)
  61.  
  62. local stroke = Instance.new("UIStroke")
  63. stroke.Thickness = 3
  64. stroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Contextual
  65. stroke.Parent = label
  66.  
  67. billboard.Parent = object
  68. return billboard
  69. end
  70.  
  71. local function UpdateEsp(objectId, petName)
  72. local object = getObjectFromId(objectId)
  73. if not object or not espCache[objectId] then return end
  74. local eggName = object:GetAttribute("EggName")
  75. local labelGui = espCache[objectId]
  76. if labelGui and labelGui:FindFirstChildOfClass("TextLabel") then
  77. labelGui.TextLabel.Text = `{eggName} | {petName}`
  78. end
  79. end
  80.  
  81. local function AddEsp(object)
  82. if object:GetAttribute("OWNER") ~= localPlayer.Name then return end
  83. local eggName = object:GetAttribute("EggName")
  84. local petName = eggPets[object:GetAttribute("OBJECT_UUID")]
  85. local objectId = object:GetAttribute("OBJECT_UUID")
  86. if not objectId then return end
  87. local esp = CreateEspGui(object, `{eggName} | {petName or "?"}`)
  88. espCache[objectId] = esp
  89. activeEggs[objectId] = object
  90. end
  91.  
  92. local function RemoveEsp(object)
  93. if object:GetAttribute("OWNER") ~= localPlayer.Name then return end
  94. local objectId = object:GetAttribute("OBJECT_UUID")
  95. if espCache[objectId] then
  96. espCache[objectId]:Destroy()
  97. espCache[objectId] = nil
  98. end
  99. activeEggs[objectId] = nil
  100. end
  101.  
  102. for _, object in collectionService:GetTagged("PetEggServer") do
  103. task.spawn(AddEsp, object)
  104. end
  105.  
  106. collectionService:GetInstanceAddedSignal("PetEggServer"):Connect(AddEsp)
  107. collectionService:GetInstanceRemovedSignal("PetEggServer"):Connect(RemoveEsp)
  108.  
  109. local old
  110. old = hookfunction(getconnections(replicatedStorage.GameEvents.EggReadyToHatch_RE.OnClientEvent)[1].Function, newcclosure(function(objectId, petName)
  111. UpdateEsp(objectId, petName)
  112. return old(objectId, petName)
  113. end))
Advertisement
Add Comment
Please, Sign In to add comment