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

Indexing a player search and linking it with a player ID?

I'm trying to figure out how to successfully create a search system for a data center I am working on.

I would need to pull IDs from usernames that are searched.

For example, if I searched cloudwork, I would want that user's avatar image to pop up and I would want their data to appear in my data center.

I need to know how to get an ID from a username.

3 answers

✓ Accepted answer

You can only get someone's ID from their username in-game by accessing the userId property of their player instance

A way to get an image from someone's username is to use the URL template; http://www.roblox.com/Thumbs/Avatar.ashx?format=png&x=100&y=100&username= followed by the player's username.

Ex;

local template = 'http://www.roblox.com/Thumbs/Avatar.ashx?format=png&x=100&y=100&username='

local name = 'Goulstem'

local imageId = template..name

Other than that then all I can say is some HTML magic stuff..

To add on to SurVur's answer:

local Api = "http://api.roblox.com/users/get-by-username?username=%s"
local Http = Game:GetService("HttpService")

local Id = Http:JSONDecode(Http:GetAsync(Api:format("NotsoPenguin"))).Id

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