Answers for "roblox getting a player via userid"

7

get name from user id roblox

--Name => UserId:
name = Players:GetNameFromUserIdAsync(userId)

--UserId => Name:
id = Players:GetUserIdFromNameAsync(name)
Posted by: Guest on August-24-2020
1

get player id from character roblox

local Players = game:GetService("Players")
local function getPlayerByUserId(userId)
	for _, player in pairs(Players:GetPlayers()) do
		if player.UserId == userId then
			return player
		end
	end
end
Posted by: Guest on November-17-2020

Browse Popular Code Answers by Language