Getting a players new username from old one

I never mentioned AI autocorrect.

“when I type in their old username since that’s what they were last identified as, the game will immediately correct it to their newest username.”

I know I don’t say that, @HexticDev that said that

That’s really interesting where at?

Post 12, that’s where

Definitely helen keller, can you read?

What?

I’m not too familiar with this topic, although most of these replies aren’t very helpful. I recommend looking for a web API that allows you to get all of a player’s past usernames. I know Rolimons allows you to look at past usernames, so this should be possible. You would then need to come up with a way to search through players with that past username. Maybe log each UserID that joins your game and then create a system to loop through each logged UserID? Chances are this would be too slow although I hope this gives you a good start.

Edit: You could also log every Username that joins with their corresponding UserID and then when an admin enters a username you would have their UserID on file and then you could update it.

You can do this with the Roblox Users Web API. Specifically, the v1/usernames/users endpoint.

Here’s a sample function that can be used to fetch a user’s current username from the old username:

local HttpService = game:GetService("HttpService")

function getNewUsername(oldUsername)

    local url = "https://users.roproxy.com/v1/usernames/users" -- Proxy is required since httpservice blocks requests to their api from httpservice
    local body = HttpService:JSONEncode({
        usernames = {
            oldUsername
        },
        excludeBannedUsers = false
    })

    local success, result = pcall(function()
        return HttpService:RequestAsync({ -- Sending a post request to the endpoint
            Url = url,
            Method = "POST",
            Headers = {
                ["Content-Type"] = "application/json",
            },
            Body = body
        })
    end)

    if success then
       local body = HttpService:JSONDecode(result["Body"])
       return body["data"][1].name -- Returns the current username of the provided username
    else
      warn(result)
    end
end

print(getNewUsername("RealWindGaming")) -- RealWindGaming is my old username

-- Prints: ValiantWind
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.