Getting the name of a player from data store

I have to loop through 100 players that is stored inside a data store to put their names on a leaderboard.

I’m making this post because :GetNameFromUserIdAsync() gives me a “Too Many Requests” error.
I saw a post about this which recommended making a cache but I wanted to know if there was an easier solution to this.

You’re breaking the rate limit, does the loop have a task.wait() call?

Yes, I added a task.wait(0.3). Is that not enough?

I will refer you to the roblox dev documentation.
DO NOT CALL ASYNC SO FAST!!! SOTP IT!!! AHHHHHHHHHHH!!!
Please switch to profile service or some other data storing method there are quite a few new ones out too. This allows you to call the player directly of the datastore.

Honestly it’s Roblox’s fault for not having asynchronous task support, so blame them not us

Nooooo nooo, do you not understand the real world problems of that? The reason they do this is because its safe, and it allows for anyone in the world to code and make games. I would never allow someone the access to call async millions of times a second to my server. That is how you crash your entire server base in 1 day lol. If they enabled that they would have to verify and require devs to go through an application process to become a trusted dev. Do you really want that?

Yes, a rate limit is required but imagine how easier life would be if we had an await keyword lol

I know that it’s bad to call async so fast that’s why I made this post. What are the new data storing methods?

You should only ever call “getnamefromuserid” once, and that is when you are adding a player into your leaderboard. After that point their name should be cached for easy reuse.

Just use ProfileService, it’s probably the most reliable and has a very simple API

PS: To solve your problem, simply store the player’s name inside the PlayerData hierarchy

I will look into it. Thanks for everyone’s help!

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