I made it so that it pops up when you pick up a egg or if you get coins. When i pick up the eggs the popup works fine, but then when i go and sell my eggs to coins and i go back to the eggs and try to pick them up the popup doesn't show on screen. Then randomly it starts working when you pickup af lot of eggs.
Gif that show how it looks like: https://gyazo.com/ade66de5e3beb2264e2c392b428cd326
The script for the popup
wait()
local player = game.Players.LocalPlayer
local leaderstats = player:WaitForChild("leaderstats")
if leaderstats then
local Eggs = leaderstats:FindFirstChild("Eggs")
if Eggs then
local lastvalue = Eggs.Value
Eggs.Changed:connect(function()
if Eggs.Value >= lastvalue then
local NewUi = script.TextLabel:Clone()
NewUi.Parent = script.Parent
NewUi.Visible = true
NewUi.Text = "????"..Eggs.Value - lastvalue
NewUi.Position = UDim2.new(0.477,0,0.460,0)
NewUi:TweenPosition(UDim2.new(0.066,0,0.405,0),"Out",0.2,true)
wait(0.95)
NewUi:Destroy()
lastvalue = Eggs.Value
end
end)
end
end

2 comments
Thank you. Had to keep line 7 tho.
Alright, no problem! Glad to help. If this worked, select it as an answer so everyone else knows this question has been solved.