Hi all developers, i have a problem with an error saying “TooManyRequests”
I created a GUI that shows all the duck are in the game by cloning a frame to every duck info i insert in the module script.
In the script there is “game:GetService(“BadgeService”):UserHasBadgeAsync(player.UserId, badgeId)” so it shows what ducks i have and what ducks i don’t have by the red/green background when it loads.
When i load the game, it runs perfectly, all ducks are in the gui with green/red background(by the ducks i collected so far), but when i reset(Character Reset) the gui clear all the childrens and it clone the ducks again causing the error “TooManyRequests”
I wanted to know, if it’s possible to when i collect a duck(like wood duck) it make a green background in the ducks gui(wood duck) because if i put :ClearAllChildren() to refresh the gui it will broke saying “TooManyRequests”
How do i need to fix this problem? Thanks!
Scripts:
The Local Script that clone the template frame for every duck is in the Module Script by making green the backgrounds for the ducks(badgeIDs) i have and making it red for the ducks i dont own:
local Ducks = require(game:GetService("ReplicatedStorage").DucksUIHandler.Ducks)
local BadgeService = game:GetService("BadgeService")
for _, duck in ipairs(Ducks) do
local duckFrame =game.ReplicatedStorage.DucksUIHandler.Template:Clone()
duckFrame.Parent = script.Parent.Frame.Container
duckFrame.Name = duck.ID
duckFrame.ImageLabel.Image = "rbxthumb://type=Asset&id="..duck.imageID.."&w=420&h=420"
if duck.difficulty == "EASY" then
duckFrame.DifficultyLabel.Text = duck.difficulty
duckFrame.DifficultyLabel.BackgroundColor3 = Color3.fromRGB(25,191,0)
elseif duck.difficulty == "MEDIUM" then
duckFrame.DifficultyLabel.Text = duck.difficulty
duckFrame.DifficultyLabel.BackgroundColor3 = Color3.fromRGB(255,170,0)
elseif duck.difficulty == "HARD" then
duckFrame.DifficultyLabel.Text = duck.difficulty
duckFrame.DifficultyLabel.BackgroundColor3 = Color3.fromRGB(170,0,0)
elseif duck.difficulty == "MYTHICHAL" then
duckFrame.DifficultyLabel.Text = duck.difficulty
duckFrame.DifficultyLabel.BackgroundColor3 = Color3.fromRGB(255,0,255)
elseif duck.difficulty == "LIMITED" then
duckFrame.DifficultyLabel.Text = duck.difficulty
duckFrame.DifficultyLabel.BackgroundColor3 = Color3.fromRGB(255,255,255)
elseif duck.difficulty == "EXCLUSIVE" then
duckFrame.DifficultyLabel.Text = duck.difficulty
duckFrame.DifficultyLabel.BackgroundColor3 = Color3.fromRGB(170, 85, 255)
elseif duck.difficulty == "SOON" then
duckFrame.DifficultyLabel.Text = duck.difficulty
duckFrame.DifficultyLabel.BackgroundColor3 = Color3.fromRGB(0,0,0)
duckFrame.DifficultyLabel.TextColor = BrickColor.new("White")
end
duckFrame.Namef.Text = duck.name
if BadgeService:UserHasBadgeAsync(game.Players.LocalPlayer.UserId, duck.badgeID) then
duckFrame.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
else
duckFrame.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
end
end
This is the Module Script where all the duck to clone are:
local Ducks = {
{
ID = "NormalDuck",
name = "Normal Duck",
difficulty = "EASY",
badgeID = 2129399897,
imageID = 11552766665,
},
{
ID = "TreeDuck",
name = "Tree Duck",
difficulty = "EASY",
badgeID = 2129400307,
imageID = 11552821903,
},
{
ID = "WaterDuck",
name = "Water Duck",
difficulty = "EASY",
badgeID = 2129400213,
imageID = 11552864141,
},
{
ID = "PondDuck",
name = "Pond Duck",
difficulty = "EASY",
badgeID = 2129410424,
imageID = 11550745222,
},
{
ID = "WoodDuck",
name = "Wood Duck",
difficulty = "EASY",
badgeID = 2129410047,
imageID = 0,
},
{
ID = "CarpetDuck",
name = "Carpet Duck",
difficulty = "EASY",
badgeID = 2129410072,
imageID = 0,
},
{
ID = "CrystalDuck",
name = "Crystal Duck",
difficulty = "EASY",
badgeID = 2129662321,
imageID = 0,
},
{
ID = "DirtDuck",
name = "Dirt Duck",
difficulty = "EASY",
badgeID = 2129400129,
imageID = 0,
},
{
ID = "CartoonDuck",
name = "Cartoon Duck",
difficulty = "EASY",
badgeID = 2132425426,
imageID = 0,
},
{
ID = "VRDuck",
name = "VR Duck",
difficulty = "EASY",
badgeID = 2132443332,
imageID = 0,
},
{
ID = "CartoonTreeDuck",
name = "Carton Tree Duck",
difficulty = "EASY",
badgeID = 2132434532,
imageID = 0,
},
{
ID = "RichDuck",
name = "Rich Duck",
difficulty = "EASY",
badgeID = 2136528866,
imageID = 0,
},
{
ID = "RealisticDuck",
name = "Realistic Duck",
difficulty = "EASY",
badgeID = 2137951566,
imageID = 0,
},
{
ID = "LegoDuck",
name = "Lego Duck",
difficulty = "EASY",
badgeID = 2140892111,
imageID = 0,
},
{
ID = "ImposterDuck",
name = "Imposter Duck",
difficulty = "EASY",
badgeID = 2140915220,
imageID = 0,
},
{
ID = "MotherDuck",
name = "Mother Duck",
difficulty = "EASY",
badgeID = 2141215527,
imageID = 0,
},
{
ID = "FisherDuck",
name = "Fisher Duck",
difficulty = "MEDIUM",
badgeID = 2141215707,
imageID = 0,
},
{
ID = "DominusDuck",
name = "Dominus Duck",
difficulty = "MEDIUM",
badgeID = 0,
imageID = 0,
},
{
ID = "WeirdGreenDuck",
name = "Weird Green Duck",
difficulty = "MEDIUM",
badgeID = 2140915420,
imageID = 0,
},
{
ID = "BusinessDuck",
name = "Business Duck",
difficulty = "MEDIUM",
badgeID = 2136517363,
imageID = 0,
},
{
ID = "SecretDuck",
name = "Secret Duck",
difficulty = "MEDIUM",
badgeID = 2129465218,
imageID = 0,
},
{
ID = "RainbowDuck",
name = "Rainbow Duck",
difficulty = "MEDIUM",
badgeID = 2129589249,
imageID = 0,
},
{
ID = "PartyDuck",
name = "Party Duck",
difficulty = "MEDIUM",
badgeID = 2129689996,
imageID = 0,
},
{
ID = "BlockDuck",
name = "Block Duck",
difficulty = "MEDIUM",
badgeID = 2129489121,
imageID = 0,
},
{
ID = "HallDuck",
name = "Hall Duck",
difficulty = "MEDIUM",
badgeID = 2129400376,
imageID = 0,
},
{
ID = "BallDuck",
name = "Ball Duck",
difficulty = "MEDIUM",
badgeID = 2129475142,
imageID = 0,
},
{
ID = "StoneDuck",
name = "Stone Duck",
difficulty = "MEDIUM",
badgeID = 2129475107,
imageID = 0,
},
{
ID = "PurpleDuck",
name = "Purple Duck",
difficulty = "MEDIUM",
badgeID = 2129465148,
imageID = 0,
},
{
ID = "MaterialDuck",
name = "Material Duck",
difficulty = "MEDIUM",
badgeID = 2133537138,
imageID = 0,
},
{
ID = "CyborgDuck",
name = "Cyborg Duck",
difficulty = "MEDIUM",
badgeID = 2133939979,
imageID = 0,
},
{
ID = "FunDuck",
name = "Fun Duck",
difficulty = "MEDIUM",
badgeID = 2140853319,
imageID = 0,
},
{
ID = "BalloonDuck",
name = "Balloon Duck",
difficulty = "MEDIUM",
badgeID = 2140892550,
imageID = 0,
},
{
ID = "ChickensDuck",
name = "Chicken's Duck",
difficulty = "HARD",
badgeID = 2140853607,
imageID = 0,
},
{
ID = "SizeDuck",
name = "Size Duck",
difficulty = "HARD",
badgeID = 2133537084,
imageID = 0,
},
{
ID = "ObbyDuck",
name = "Obby Duck",
difficulty = "HARD",
badgeID = 2129489219,
imageID = 0,
},
{
ID = "GlitchDuck",
name = "Glitch Duck",
difficulty = "HARD",
badgeID = 2129522894,
imageID = 0,
},
{
ID = "SmallDuck",
name = "Small Duck",
difficulty = "HARD",
badgeID = 2129489283,
imageID = 0,
},
{
ID = "FireDuck",
name = "Fire Duck",
difficulty = "MYTHICHAL",
badgeID = 2129676545,
imageID = 0,
},
{
ID = "VoidDuck",
name = "Void Duck",
difficulty = "MYTHICHAL",
badgeID = 2137924000,
imageID = 0,
},
{
ID = "FootballDuck",
name = "Football Duck",
difficulty = "LIMITED",
badgeID = 2129578939,
imageID = 0,
},
{
ID = "RudolfFuck",
name = "Rudolf Duck",
difficulty = "LIMITED",
badgeID = 2129893347,
imageID = 0,
},
{
ID = "SantaDuck",
name = "Santa Duck",
difficulty = "LIMITED",
badgeID = 2129866631,
imageID = 0,
},
{
ID = "FestiveDuck",
name = "Festive Duck",
difficulty = "LIMITED",
badgeID = 2129893777,
imageID = 0,
},
{
ID = "CoolWinterDuck",
name = "Cool Winter Duck",
difficulty = "LIMITED",
badgeID = 2129913656,
imageID = 0,
},
{
ID = "Cozy Duck",
name = "Cozy Duck",
difficulty = "LIMITED",
badgeID = 2129893850,
imageID = 0,
},
{
ID = "IceDuck",
name = "Ice Duck",
difficulty = "LIMITED",
badgeID = 2129892450,
imageID = 0,
},
{
ID = "RBBBadge",
name = "RBB Badge",
difficulty = "LIMITED",
badgeID = 2129779086,
imageID = 0,
},
{
ID = "DogeDuck",
name = "Doge Duck",
difficulty = "LIMITED",
badgeID = 2130202531,
imageID = 0,
},
{
ID = "CatDuck",
name = "Cat Duck",
difficulty = "LIMITED",
badgeID = 2130204171,
imageID = 0,
},
{
ID = "500VisitsDuck",
name = "500 Visits Duck",
difficulty = "LIMITED",
badgeID = 2132619780,
imageID = 0,
},
{
ID = "WorldCupDuck",
name = "World Cup Duck",
difficulty = "LIMITED",
badgeID = 2129567969,
imageID = 0,
},
{
ID = "1000VisitsDuck",
name = "1000 Visits Duck",
difficulty = "LIMITED",
badgeID = 2141413242,
imageID = 12574053265,
},
{
ID = "DuckMortus",
name = "Duck Mortus",
difficulty = "EXCLUSIVE",
badgeID = 2129511992,
imageID = 0,
},
{
ID = "ToyDuck",
name = "Toy Duck",
difficulty = "EXCLUSIVE",
badgeID = 2132594355,
imageID = 0,
},
{
ID = "ComingSoon",
name = "Coming Soon",
difficulty = "EXCLUSIVE",
badgeID = 2140915322,
imageID = 0,
}
}
return Ducks
There are some images:
These are the images when i run the game(It is fine):
This is when i reset and it won’t load all the ducks: