I’m currently working on a Find The Chomiks fangame, the index GUI in it is a bit bugged. It works fine when you just join but when you reset it begins to say ‘Too many requests’ in the console and won’t load in some of the findables. If you reset enough none will show up except for one, here’s the code for the index GUI:
local BadgeService = game:GetService("BadgeService")
local player = script.Parent.Parent.Parent.Parent.Parent
local UserId = player.UserId
local sands = script.sands.Value --How many of the findables there are
local found = script.found.Value --How many findables you've found
task.wait(1)
for _,sans in pairs(workspace.sansers:GetChildren()) do
sands += 1
local template = game.ServerStorage.Sans:Clone() --The frame panel that shows the specific findable
local BadgeId = sans.BadgeId.Value
template.Name = sans.Name
template.SandName.Text = sans.Name
template.Parent = script.Parent.Frame
template.Sand.Image = sans.Decal.Texture
template.Sand.hint.Value = sans.Hint.Value
template.Sand.BadgeId.Value = sans.BadgeId.Value
if sans.Diff.Value == "effortless" then
template.LayoutOrder = -14
template.Diff.ImageColor3 = Color3.new(0, 0.807843, 0)
elseif sans.Diff.Value == "easy" then
template.LayoutOrder = -13
template.Diff.ImageColor3 = Color3.new(0.462745, 0.956863, 0.278431)
elseif sans.Diff.Value == "medium" then
template.LayoutOrder = -12
template.Diff.ImageColor3 = Color3.new(1, 1, 0)
elseif sans.Diff.Value == "hard" then
template.LayoutOrder = -11
template.Diff.ImageColor3 = Color3.new(0.996078, 0.486275, 0)
elseif sans.Diff.Value == "difficult" then
template.LayoutOrder = -10
template.Diff.ImageColor3 = Color3.new(1, 0.0470588, 0.0117647)
elseif sans.Diff.Value == "challenging" then
template.LayoutOrder = -9
template.Diff.ImageColor3 = Color3.new(0.760784, 0, 0)
elseif sans.Diff.Value == "intense" then
template.LayoutOrder = -8
template.Diff.ImageColor3 = Color3.new(0.0980392, 0.133333, 0.176471)
elseif sans.Diff.Value == "remorseless" then
template.LayoutOrder = -7
template.Diff.ImageColor3 = Color3.new(0.788235, 0, 0.784314)
elseif sans.Diff.Value == "insane" then
template.LayoutOrder = -6
template.Diff.ImageColor3 = Color3.new(0, 0, 1)
template.Diff.Image = "http://www.roblox.com/asset/?id=3057073083"
elseif sans.Diff.Value == "extreme" then
template.LayoutOrder = -5
template.Diff.ImageColor3 = Color3.new(0.00784314, 0.541176, 1)
template.Diff.Image = "http://www.roblox.com/asset/?id=3057073083"
elseif sans.Diff.Value == "terrifying" then
template.LayoutOrder = -4
template.Diff.ImageColor3 = Color3.new(0, 1, 1)
template.Diff.Image = "http://www.roblox.com/asset/?id=3057073083"
elseif sans.Diff.Value == "catastrophic" then
template.LayoutOrder = -3
template.Diff.ImageColor3 = Color3.new(1, 1, 1)
template.Diff.Image = "http://www.roblox.com/asset/?id=3057073083"
elseif sans.Diff.Value == "horrific" then
template.LayoutOrder = -2
template.Diff.ImageColor3 = Color3.new(0.92549, 0.698039, 0.980392)
template.Diff.Image = "http://www.roblox.com/asset/?id=13913626824"
template.UIStroke.Color = Color3.new(0.92549, 0.698039, 0.980392)
template.SandName.TextStrokeColor3 = Color3.new(0.92549, 0.698039, 0.980392)
template.SandName.TextColor3 = Color3.new(0,0,0)
elseif sans.Diff.Value == "unreal" then
template.LayoutOrder = -1
template.Diff.ImageColor3 = Color3.new(0.294118, 0, 0.784314)
template.Diff.Image = "http://www.roblox.com/asset/?id=13913626824"
template.UIStroke.Color = Color3.new(0.294118, 0, 0.784314)
template.SandName.TextStrokeColor3 = Color3.new(0.294118, 0, 0.784314)
template.SandName.TextColor3 = Color3.new(0,0,0)
end
if BadgeId ~= nil and BadgeId ~= 0 then
if BadgeService:UserHasBadgeAsync(UserId, BadgeId) then
template.Sand.ImageTransparency = 0
found += 1
end
end
script.Parent.Parent.Finds.Text = found.."/"..sands
task.wait()
end
Now I do think I have a good idea of what the problem is, the console says that it’s this line of code right here:
if BadgeId ~= nil and BadgeId ~= 0 then
if BadgeService:UserHasBadgeAsync(UserId, BadgeId) then
template.Sand.ImageTransparency = 0
found += 1
end
end
I’m certain it’s because it’s trying to call for the UserId and the BadgeId/BadgeService every single time it spawns a frame of a findable in the index which the game cannot handle, which prompts the ‘Too many requests’ error in the console. I know what the issue is, but the question is how do I make it so that it doesn’t prompt that error in the console and bug out the index entirely?
I also have a separate GUI which credits the original creators of the findables, that never bugs out because it doesn’t require any usage of the BadgeService.
I haven’t really looked for any solutions in the Developer Hub yet, though I have tried putting the BadgeId value within the frame itself:
local template = game.ServerStorage.Sans:Clone()
But that showed almost the exact same results, I’ve also rewatched the tutorial video by parkeroogabooga that I watched to even make the index GUI at all, I was unable to get much out of it besides adding the:
if BadgeId ~= nil and BadgeId ~= 0 then
part to the code, thinking that that might stop the error from happening to no avail.
So if anybody might know how to prevent that error from happening then please do show me, I will be forever grateful for your help. Thank you!