I am working on a game lobby that will allow player to join into a game if they search for a friends player name, but I have not been able to find any way to get the userId from the player's name. The two players will probably not be in the same lobby either.
This is what I have so far
local teleService = game:GetService("TeleportService")
module.GetPlayerLocation = function(playerName)
local userId
--convert player's name (playerName) into their userId
local success, errorMsg, placeId, instanceId = teleService:GetPlayerPlaceInstanceAsync(userId)
if (success) then
return placeId, instanceId
else
return false
end
end

2 comments
Use the GetUserIdFromNameAsync function from the Players Service. http://wiki.roblox.com/index.php?title=API:Class/Players/GetUserIdFromNameAsync However, you will want to protect the script from breaking if someone were to place a invalid name.
Thanks