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

How do I get the username from a username ID?

I don't just want a link to a proxy or third-party API or even ROBLOX's API; can you show me how to use it in a script?

3 answers

When scripting, you only use the last several digits of the username, if this is what you mean.

To target a SPECIFIC ITEM, you usually enter it like this.

187846561

But the whole script is the whole line at the top, some gamepasses require this method of insertion

http://www.roblox.com/Neon-Purple-Animal-Hoodie-item?id=187846561

If you want a SPECIFIC player to have, let's say Kohls Admin, you enter their username (CaSe SenSiTIvE) into a script. For example, we'll use the 'admins' dialogue.

local admins = {"UsErNaMeHEre"} -- Gives a user Administrative access, replace UsErNaMeHEre with the desired username.

To grant a user's ID entrance (VIP Doors) you need the last numbers of their ID.

To grant a Shirt in, you need to have the last numbers of their ID, to grant a GamePass in, you need to have the whole ID

PassOrShirtID = 114508316  -- Change this to your asset/shirt/badge/pass ID

I hope I helped with your problem. If you need more clarification, PM me on ROBLOX.

Accept this if I helped.

Well just to be nice here you go!

local function GetUsernameFromId(ID)
	ID = tonumber(ID) -- make sure its a number...
	
	if ID and ID > 0 then -- make sure it exists and is > 0
		local data = game:GetService('InsertService'):GetUserSets(ID) -- Fetch sets that the user has
		if data then
			local list = data[1] -- the first value, P.S. it does not have to be 1 I set it to 1 because it normaly allways exsists
			if list then -- just to make sure
				local name = list['CreatorName'] -- the username index
				if name then -- just to be safe
					return name
				end
			end
		end
		return 'Guest' -- Defaults to Guests because their IDs are below 0
	end
end

function used: GetUserSets

I am sure this is what you wanted....

Enjoy!

sinking to the bottom

1 comment

0

There isn't a "bump" functionality on this website; that wouldn't make sense.

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