HTTP 429 (Too Many Requests)?

Hi there,

I’ve got this script that gets Group Members via HTTP but i’m getting the Error code: HTTP 429 (Too Many Requests) Note it’s not always but its about 50/50

Script:

local part = game.Workspace.Part
local part2 = game.Workspace.Part2

local GroupService = game:GetService(“GroupService”)
local Players = game:GetService(“Players”)
local HttpService = game:GetService(“HttpService”)
GroupID = nil

local function playerAdded(player)
wait(2)
local groups = GroupService:GetGroupsAsync(player.UserId)
for _, groupInfo in pairs(groups) do
for key, value in pairs(groupInfo) do
if groupInfo.IsPrimary then print(groupInfo.Name,groupInfo.Id)
GroupID = groupInfo.Id
part2.Decal.Texture = (groupInfo.EmblemUrl)
part.SurfaceGui.GroupNameText.Text = (groupInfo.Name)
end
end
end
end

Players.PlayerAdded:Connect(playerAdded)
wait(5)
local groupData = HttpService:JSONDecode(HttpService:GetAsync(“https://groups.rprxy.xyz/v1/groups/“..GroupID..””))
part.SurfaceGui.MembersText.Text = (groupData.memberCount)

Thanks,

2 Likes

Too many requests means it happens too many times

This means that you’re sending to many request to the Web Server that is hosting the api.

You could avoid hitting rate limits by making a request at certain intervals.

This is nothing you can fix rather than have good practices, and only make requests when you need too.

Although your rate-limit may reset in about 15 minutes -1h Somewhere in that range. And you’ll be good. As this is the time most Api’s use when setting their rate limits.

Yeah i understand the error but surely its not sending to much?, It should only run once a Player has joined right?

Lets pretend you have 1,000 active players. That’s a LOT of http requests. This isn’t the correct way to go about things

First, create a web server. I recommend https://repl.it

then send the http request to your own server

GET request to https://domain.com/membercount

the code for the server:

const express=require("express")
const app=new express()
const fetch=require("node-fetch")
const GROUP_ID=1
var mc=0
app.get('/',(req,res)=>{
res.send("meow")
})
fetch(`https://groups.roblox.com/v1/groups/`+GROUP_ID).then(res=>res.json()).then(res=>{
mc=res.memberCount

})

setInterval(function(){
fetch(`https://groups.roblox.com/v1/groups/`+GROUP_ID).then(res=>res.json()).then(res=>{
mc=res.memberCount

})


},10000)
app.get('/membercount',(req,res)=>{
res.send(`{"mc":${mc}}`)
})

app.listen(3000)

(its nodejs)

3 Likes

This happens to me as well, and only simply from having too much assets in my experience, is there a way to slow load the items?

u gotta pay money to keep it running for the entire month glitch.com is free however if u send 4000 requests an hour it rate limits