📜  roblox 从角色中获取玩家 - 无论代码示例

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

代码示例1
local character = game.Workspace.Player
local player = game.Players:GetPlayerFromCharacter(character)

--This function above will return the object value of the player
--if that character dosen't have a player, it will return nil instead
 
if player then
    print("Player is " .. player.Name)
else
    print("Player doesn't exist!")
end