ServerScript
print("wait 15 second")
wait(15) --15초를 기다린뒤,
--게임의 모든 플레이어를 Game:GetAllPlayer()로 얻은 다음,
--AllPlayer 변수에 할당해요.
local AllPlayer = Game:GetAllPlayer()
--반복문을 이용해서 AllPlayer 변수에 할당된 플레이어들의 이름을 print로 출력해요.
--첫번째(i = 1)부터 시작해서,
--AllPlayer의 크기(#AllPlayer)만큼 반복하고
--n번째 자식 오브젝트(AllPlayer[i])의 이름을 로그창에 출력해요.
for i = 1, #AllPlayer do
print("Player Name : " .. AllPlayer[i]:GetName())
end
더보기
함수
string GetName()
객체의 이름을 얻을 수 있어요.
샘플
print(Workspace.Floor:GetName()) --오브젝트의 이름을 문자열로 반환해요.
-- Tip --
멀티테스트로 실행하면 플레이어의 이름이 플레이어 수 만큼 출력되는 것을 확인할 수 있어요.
Script Log
'LuaScript' 카테고리의 다른 글
[디토랜드] GetColor&SetColor (0) | 2021.12.23 |
---|---|
[디토랜드] GetName&SetName (0) | 2021.12.23 |
[디토랜드] GetCharacter&GetPlayer (0) | 2021.12.23 |
[디토랜드] ScriptParameter - 스크립트 파라미터, 스크립트 프로퍼티 (0) | 2021.12.22 |
[디토랜드] Table - table.insert, table.remove (0) | 2021.12.22 |