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
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
Roblox Get player by name
local function getPlayerFromName(name)
-- loop over all players:
for _, player in pairs(game:GetService("Players"):GetPlayers()) do
-- if their name matches (case insensitive), return with that player:
if player.Name:lower() == name:lower() then
return player
end
end
-- if we reach the end of the for-loop, no player with that name was found
end
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us