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

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

Asked by 9 years ago

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

Log in to vote
1
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
9 years ago

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..

Ad
Log in to vote
2
Answered by
SurVur 86
9 years ago

You could use this link: http://api.roblox.com/users/get-by-username?username=USERNAME_HERE

ex: ROBLOX

Log in to vote
1
Answered by 9 years ago

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

Answer this question