UserSearch.FocusLost:Connect(function()
local userId = UserSearch.Text
if tonumber(userId) then
local plrInfo = game:GetService("UserService"):GetUserInfosByUserIdsAsync({tonumber(userId)})[1]
if plrInfo then
local age = plrInfo.AccountAge
UserAge.Text = age
end
end
end)
Output: Unable to assign property Text. String expected, got nil.
While you can use .AccountAge on a player Instance, that is only possible if the user is in the server.
In order to access the account age of a player not in the server, you will need to use a proxy hooked up to one of the various Roblox APIs, such as ones listed in Swagger UI. I don’t believe it tells you the actual age, but it does tell you when the account was created, so you can calculate it from that
Is there a way to retrieve player’s account age when you enter their username through textbox, it can be from their userid or by their username. (when there are in server, else it will show nil)