Why is it when I am trying to get a player's UserId from their name it leads me to a completely different Id?

So, I am using ‘GetUserIdFromNameAsync’ to try and get the user ID, however, whenever I print this out it gives me a completely different Id leading to the account of ‘Instance’; account Id = 73502

counter.OnServerInvoke = function(playerName)
	
	print(playerName)
	local playerId = Players:GetUserIdFromNameAsync(playerName)	
	
	print(playerId)

The first print works as normal, printing the player name, but when attempting to print ‘playerId’ it prints the wrong Id.

Also, if I try printing the name from the UserId it also prints out the player account ‘Instance’

	print(Players:GetNameFromUserIdAsync(playerId))

Try doing

Players:GetUserIdFromNameAsync(playerName.Name)

I forgot to add, the variable of ‘playerName’ is coming right from a TextBox.

OnServerInvoke has two parameters:
The player who activated this, and the parameters that you sent from the client.
So, it should be like this:

counter.OnServerInvoke = function(player, playerName)
2 Likes