I am making a game where an NPC calls you by your first ever username (the username you first used to join roblox). I have spent a while going through the forum and I have seen nothing. Is there is any other way to get the player’s first username?
If not, I may just have to make the NPC call the user by their current username.
Well, you either have to create your own proxy (better for security) or use an existing one (like roproxy). Then do HttpService:GetAsync(PROXY_URL) o retrieve the info
local HttpService = game:GetService("HttpService")
local UserId = PLAYER_USERID
local UsernameHistory = HttpService:JSONDecode(HttpService:GetAsync(`https://users.roproxy.com/v1/users/{UserId}/username-history`))
local previousUsernames = UserNameHistory.data
if #previousUsernames == 0 then
warn("Player has no previous usernames")
end
for _, previousUsername in previousUsernames do
print(previousUsername)
end
local firstUsername = previousUsernames[1].name
game.ReplicatedStorage.Events.UserIDSent.OnServerEvent:Connect(function(plr)
local HttpService = game:GetService("HttpService")
local UserId = plr.UserId
local UsernameHistory = HttpService:JSONDecode(HttpService:GetAsync(`https://users.roproxy.com/v1/users/{UserId}/username-history`))
local previousUsernames = UsernameHistory.data
if #previousUsernames == 0 then
warn("Player has no previous usernames")
end
for _, previousUsername in previousUsernames do
print(previousUsername)
end
local firstUsername = previousUsernames[1].Name
script.Parent.Value = firstUsername
end)