스크립트 (서버 스크립트)
Empty
Empty
Empty
스크립트는 게임을 제어하는 주 컴퓨터(서버)에서만 실행되는 코드입니다.
Empty
Empty
Empty
게임 규칙, 플레이어 데이터 관리, 모든 사람에게 공정하고 안전한 작업 처리와 같은 중요한 작업을 처리합니다.
Empty
Empty
Empty
게임 상태 관리 | 플레이어 점수를 추적하고, 게임 승자를 결정합니다. |
보안 및 검증 | 플레이어가 구매를 진행할 수 있을 만큼 충분한 화폐를 가지고 있는지 확인합니다. |
공유 환경 변경 | 공유 객체의 위치를 업데이트합니다. |
네트워킹 및 통신 | 서버 검증이 필요한 작업을 수행하거나 모든 클라이언트에서 이벤트를 트리거합니다. |
Empty
Empty
Empty
-- Script in ServerScriptService
-- Get the Players service
local Players = game:GetService("Players")
-- Function to run when a player joins
local function onPlayerAdded(player)
print("Welcome to the game, " .. player.Name .. "!")
end
-- Connect the function to the PlayerAdded event
Players.PlayerAdded:Connect(onPlayerAdded)