📜  Roblox 按名称获取玩家 - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:25.930000             🧑  作者: Mango

代码示例1
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