플레이어가 들어왔을때 플레이어 화면에 환영 메세지를 띄워줍니다.
즉, RemoteEvent를 통해, 서버에서 localscript의 함수를 event로 호출합니다.
(다른 플레이어에게는 환영 메시지가 안보입니다.)
-- ServerScript
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEventJoin = ReplicatedStorage:WaitForChild("RemoteEventNotify")
local function playerJoin(player)
wait(5)
remoteEventJoin:FireClient(player, "Welcome to Nobakee Game!!!")
end
game.Players.PlayerAdded:Connect(playerJoin)
-- localScript
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEventNoti = ReplicatedStorage:WaitForChild("RemoteEventNotify")
local function onNotifyPlayer(noti_msg)
local player_gui = game:GetService('Players').LocalPlayer:WaitForChild('PlayerGui')
local screen_gui = player_gui:WaitForChild("ScreenGui")
screen_gui.WelcomeBox.Text = noti_msg
wait(5)
screen_gui.WelcomeBox.Text = ""
end
remoteEventNoti.onClientEvent:Connect(onNotifyPlayer)
'Roblox Script' 카테고리의 다른 글
#11 : 그룹에 따라 팀 나누기 (Team by Group) (0) | 2020.08.06 |
---|---|
#10 : 플레이어 머리에 이름 표시 - Player Title (Team / Role) BillboardGui (0) | 2020.08.06 |
#8: Data Store - 서버에 값 저장하기 (0) | 2020.08.02 |
#7 : Remote Event로 클라이언트에서 서버 호출하기 (0) | 2020.08.02 |
#6 - 효과음 넣기 (Sound effect) (0) | 2020.08.02 |