Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to get a username from a userId?

I'm making a global leaderboard and so far everything works except for displaying the players username, as it just shows the userId of the player (which is the key in my ordered data store).

name = game:GetService("HttpService"):GetAsync("http://api.roblox.com/Users/"..string.sub(id,6),false)

I know that this cannot work as it is accessing a subdomain of ROBLOX but I have no idea how else to do it. I've tried using a proxy I saw mentioned on a few other threads but I get a CURL error: Couldn't resolve host name.

Can anyone help?

1 answer

✓ Accepted answer

Why not just use GetNameFromUserIdAsync() of players? It will get the name of any user registered to the site. Except for the following Ids, I guess Roblox permanently deleted the accounts and it will return an error.

4  
5  
7  
9  
10  
11  
12  
13  
14  
15  
19  
20  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  

1 comment

0

If the wiki had been a little more helpful I would have found/used this. Thanks :p

This discussion is preserved as it was. New answers, comments, and votes are closed.