I am currently making a small little project, and I would wanna know if I could load the player’s oldest username?
Using https u can aquire the username histroy of a player
https://users.roblox.com/docs#!/Usernames/get_v1_users_userId_username_history
1 Like
local http = game:GetService("HttpService")
local getAsync = http.GetAsync
local jsonDecode = http.JSONDecode
local usernamesUrl = "https://users.roproxy.com/v1/users/%s/username-history?limit=10&sortOrder=Asc"
local function getFirstUsername(userId, retries)
retries = retries or 0
if retries >= 3 then return end
local requestUrl = usernamesUrl:format(userId)
local success, result = pcall(getAsync, http, requestUrl)
if success then
if result then
local success2, result2 = pcall(jsonDecode, http, result)
if success2 then
if result2 then
return result2.data[1].name
end
else
warn(result2)
retries += 1
getFirstUsername(userId, retries)
end
end
else
warn(result)
retries += 1
getFirstUsername(userId, retries)
end
end
local firstUsername = getFirstUsername(19688759)
print(firstUsername)
Here’s a quick script I wrote for this. There’s a maximum retries parameter which stops issuing requests after three unsuccessful attempts.
1 Like