HTTP 429 "Too Many Requests" from single function call

I used this variable

local friends = player:GetFriendsOnline

only once, like this:

local usernameTable = {}

for i,friend in pairs(friends) do
	if friend.PlaceId == (my place id) then
		table.insert(usernameTable, friend.UserName)
	end
end

but I get the above error every few test runs, about 1/3 of them. I only ever ran the tests with one alt account and I made sure the loop only happened once.

Yet when I look at my memory usage on studio, it’s ~3.2 gigabytes (although in a real server it’s far less at ~450, it still seems pretty high). When I looked at other posts with this problem, the problem usually lied in the fact that users were calling a huge amount of RemoteEvents, but I’m not doing anything like that.

What am I misunderstanding about player:GetFriendsOnline? Am I using it wrong or something? I’ll post more code if needed.

That’s an absurd amount o_o

Can you check if you have any malicious stuff inside your Studio? Cause it shouldn’t be peaking that much if you’re only calling it once

When does that function call? And just to make sure, can you add a print statement to check that it’s firing a singular time?

Worst case scenario, you delay the pairs loop using a task.wait(x) interval if it gets to that point

GetFriendsOnline has a limiter int you’re supposed to pass :GetFriendsOnline(200) it should never be more than 200 since that’s the max amount of friends a user can have

No, it’s probably not anything “Malicious” did you check if the Value is being wrapped in a recurring loop of any sort?

The only script running that is not made by me is the LampLight module. It runs very well in-game, so I doubt that could be the problem.

The function basically returns a table of your friends that are online with information such as UserName or LastLocation. I ran a print on it and it only called it once. The script takes the information and stores it in a table for use later, that way it only needs to be called once.

@Tetraic GetFriendsOnline() defaults at 200. It doesn’t seem to be looping anywhere as it’s the only place it’s called.

I’ve tried this myself and i have no issues, it’s probably a problem i’m not seeing, you need to provide more of the script.

local usernameTable = {}

for i,friend in pairs(friends) do
	if friend.PlaceId == (place id here) then
		table.insert(usernameTable, friend.UserName)
	end
end

for i,screen in pairs(everyFriendsScreen) do
	local usernameTableCopy = {}
	table.insert(usernameTableCopy, usernameTable)
	
	for i,v in pairs(usernameTableCopy) do
		for i,user in pairs(v) do
			if user then
				local newTemplate = friendTemplate:Clone()
				newTemplate.Text = user
				newTemplate.Parent = screen.ScrollingFrame
			end	
		end
	end
end

Here is more of the part of the script where GetFriendsOnline()'s data is used.

In my game, there are 4 guis, each of which have a list of TextButtons copied from ReplicatedStorage. The number of buttons is determined by however many users are found.

UPDATE: I’m not sure what I did (or what Roblox did), but when I tested it this morning the memory usage was reduced by 1 gigabyte. The website game memory actually increased by 100 megabytes, but I am experiencing no errors thus far after testing ~20 times.

I also stress tested it and ran player:GetFriendsOnline() 20 times per second in a while loop and the game did fine.

I’m sure something is going to show up/come back so I’ll keep this post open just in case.

Based on that it could possibly have had something to do with the odd server issues roblox was having. Just a theory though.

1 Like

I should have included this in the post, but there was actually an error/warning/message that popped up and quickly went away that said something along the lines of “Roblox is performing maintenance on this server” or something. That’s never happened to me before so I thought it was a fluke. Maybe it really was server issues.

1 Like

Yeah it may have been. I guess we do this every saturday now lol

little note on your memory concerns:
the studio memory is completely normal
it may seem like its a lot but studio has to have all of this loaded:
all of your plugins
the entire game
robloxs engine during playtest
studio itself

and the more memory your computer has in general (say like, 16 gigs or something), the more studio will use (it should be using the free resources it has)
often the playtest memory usage is just studio memory usage + roblox client memory usage with some +/-'s

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.