Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to get a username from a userId?

Asked by 8 years ago

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

Log in to vote
2
Answered by
M39a9am3R 3210 Moderation Voter Community Moderator
8 years ago

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  
0
If the wiki had been a little more helpful I would have found/used this. Thanks :p MasterDaniel 320 — 8y
Ad

Answer this question