Finding Players On Roblox

hi, i need a way to check if player exist from string, for example when i write “Toast” in textbox i need a script that checks if that player exist, but not in game. in roblox itself checks if a user named “Toast” exist
so bassicly with what function i can check if a user on roblox named that exist.

local Success, UserId = pcall(function() 
    return game.Players:GetUserIdFromNameAsync(Name)
end)
if Success then
    print("Player exist")
end
2 Likes

i think you didn’t understand i said i need to check if user exist on roblox, not if a player is in server

it is exactly what this code does

2 Likes

hmmmm, i will try it thanks!!! :grin:

Not only does it check for players currently in your game, but also in general , meaning with that, you could find any player and use it for stuff.

He used pcall here because it might fail sometimes, due to the fact GetUserIdFromNameAsync is a web signal, thus when there are errors/issues on the website, it might cause your code connected to that signal to fail.

it worked tysm!!! thank yall for replies :slight_smile: