Hi, i was making a Robux egg system when i found this bug:
Now i was lucky and i hatched all the same pet, but the problem is that every time i open the egg i open + 1. So the first time is good but the second time i hatch twice and the third time i hatch tre eggs.
This is the script:
elseif EggData["Currency"] == "Robux" then
warn("You Need Robux")
local userId = Player.UserId
local EggId = DevProduct[Egg].Value
MarketPlaceService:PromptProductPurchase(Player, DevProduct[Egg].Value)
MarketPlaceService.PromptProductPurchaseFinished:Connect(function(userId, EggId, didPlayerPurchase)
if didPlayerPurchase == true then
local TotalPets = totalPets(Player)
if TotalPets < Player.PlayerStats.MaxStorage.Value then
Player.leaderstats.Eggs.Value = Player.leaderstats.Eggs.Value + 1
UnBoxPet(Player, Egg, 0)
RemoteEvents.ChangePetsValue:FireClient(Player, "TotalPets")
wait(1)
end
end
end)
end
Can anyone help me?