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.
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..
You could use this link: http://api.roblox.com/users/get-by-username?username=USERNAME_HERE
ex: ROBLOX
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