Script sends too many HTTP requests despite wait time

I’m trying to make a simple group member counter on a surface gui.

The script keeps returning
'HTTP 429 (Too Many Requests) - Server - UpdateGroupData:15'

There is already a wait time and this is the only script to make calls using HTTP service.

What am I doing wrong? Do I need to change some settings? [allow https requests is on]

local groupId = 5689337


local groupData = game:GetService("GroupService"):GetGroupInfoAsync(groupId)


local httpService = game:GetService("HttpService")

local url = 'https://groups.rprxy.xyz/v1/groups/' .. groupId


while wait(5) do


	local memberCount = httpService:JSONDecode(httpService:GetAsync(url)).memberCount


	script.Parent.MemberCount.Text = "[LIVE] Members: " .. memberCount


	script.Parent.GroupName.Text = groupData.Name
	script.Parent.GroupDescription.Text = groupData.Description
end

This is a team create place with previously good performance and no broken services or problems that I’m aware of.

Maybe put a print statement inside the wait loop to see if it is actually waiting 5 seconds. If it is waiting 5 seconds, maybe increase the time it waits.

Decrease the time between API requests, you’re sending requests way to frequently.

I would recommend waiting a few minutes between requests, not 5 seconds.

1 Like

After trying this the script errors on the first cycle.

Oh, this works. I added a 5 minute delay instead.
Didn’t realize it would check how many requests would be sent, as this used to work for me.
Thanks!

It will vary between APIs are will change depending on the use of their API.

But in general, respect your usage of an API and don’t over use requests. It might even be better for you to only get the group count when the server is created or even once an hour.

1 Like