Hello!
I’m TeaAndCopy, I was messing around in studio and thought of an idea when I was changing my script from my old username to my new one. I realised that I’d have to do this every time I or someone else changed their names. I think it would be quite interesting to access a player’s previous usernames. It could look something like this:
[[This wouldn't have to be inside a local script, just an example]]
game.Players.LocalPlayer.PreviousNames -- returns a table of previous usernames
game.Players.LocalPlayer.PreviousNames.Xeorius -- Returns the specific username
-- The below code is an example of a way you could make a script work using the system
local Admins = {'Player','TeaAndCopy'}
local Player = game.Players.LocalPlayer
local OldNames = Player.PreviousNames
for i = 1, #Admins do
if Admins[i] == Player.Name then
print('Admin has arrived')
else
for _ = 1, #OldNames do
if (OldNames[_] == Player.Name) or OldNames[_] == Admins[i] then
print('Admin has arrived')
end
end
end
end
I know this can be done using UserIDs however it would be quite a lot easier to use usernames. It would allow developers to check who is in their script a lot easier and it would also mean you don’t have to search for the player every time you need to find them or add them.
I think this would be an awesome idea for those creating various administrative commands or even scripts that require a user’s name to be inside it. As previous usernames are publicly visible it wouldn’t violate any privacy rules. Even if the system just creates a variable so that each of the previous names are equal to the current.
Please feel free to post your thoughts & opinions below.
-Tea
4 Likes
You can grab the user ID for each name in your list using this method:
Then once you have converted your list of names to user IDs, simply compare that to the ID of incoming players.
PS: Requests for API changes and object behaviour changes should go in Client Features (#feature-requests:client-features). You can change the category by clicking on the pencil next to your post / title.
6 Likes
To add on top buildthomas, if you ever have trouble deciding where to categorize something:
Will it be used in-game by live servers?
→ Client Features/Bugs
Will it be used in Studio but also in-game?
→ Client Features/Bugs
Will it be used in Studio but not in-game (e.g. plugins)?
→ Studio Features/Bugs
I am aware of this, however like I said, it could be an interesting alternative.
I don’t think there needs to be an alternative if there is a simple way to do it already, that would just introduce API clutter. i.e. it only took me a minute to write this sample:
local PlayerService = game:GetService("Players")
function convertToIDs(nameTable)
local idTable = {}
for _,name in pairs(nameTable) do
pcall(function()
table.insert(idTable, PlayerService:GetUserIdFromNameAsync(name))
end)
end
return idTable
end
local Admins = convertToIDs({"Name1", "Name2", "Name3"})
-- 'Admins' is now a list of user IDs!
If you still want this feature, then there should be a use case in the OP that emphasises on why you specifically want to have a list of a user’s previous usernames. The use case right now is just to allow for some minor shorthand code, which isn’t really strong enough of a use case.
1 Like
A use case could be to simply show a user’s previous usernames for some reason or another. You could also use it to find the amount spent (R$) on usernames for that user. I’m sure there are many good reasons to having it. I don’t think it would be too hard to implement.
Until you can provide good use cases, the feature will never gain any traction. Your original use case was a bad one since as mentioned before you should be using UserIds to reference players instead of usernames. Checking the amount of ROBUX spent is too niche.
If you want to tell whose userId it is at a glance, you can store your admins as "EchoReaper 1273918"
. The username can be ignored when it’s actually being used by the script, but it’s there if you need to tell who the UserId is. If going to the site to get a UserId is too difficult for you, you can make a plugin which lets you paste in a username and spits back out a UserId, or just run print(game.Players:GetUserIdFromNameAsync("EchoReaper"))
in the command bar.
2 Likes
Not really a needed feature. Use HttpService, or better just use userIds.
3 Likes