ServerStorage

사용되지 않는 항목 표시

*이 콘텐츠는 AI(베타)를 사용해 번역되었으며, 오류가 있을 수 있습니다. 이 페이지를 영어로 보려면 여기를 클릭하세요.

만들 수 없음
서비스
복제되지 않음

서버에서만 액세스할 수 있는 컨테이너의 콘텐츠.ServerStorage에서 내려오는 개체는 클라이언트에 복제되지 않으며 LocalScripts에서 액세스할 수 없습니다.

서버 저장소가 서비스이기 때문에 방법 DataModel.GetService를 사용하여만 액세스할 수 있습니다.

맵과 같은 큰 개체를 ServerStorage에 저장하여 필요할 때까지 네트워크 트래픽이 사용되지 않으면, 게임에 참여할 때 이러한 개체를 클라이언트에 전송하여 트래픽이 소모되지 않습니다.

Scripts 는 ServerStorage에 부모로 지정될 때 실행되지 않지만 ModuleScripts 내에 포함된 것에 액세스하고 실행할 수 있습니다.개발자는 서버에서 실행하기를 원하는 Scripts 을 보유하기 위해 ServerScriptService 을 사용하는 것이 좋습니다.

ServerStorage의 내용은 서버에서만 액세스할 수 있으므로 클라이언트가 액세스할 수 있기 전에 다른 곳(예: Workspace)에 부모가 되어야 합니다.서버와 클라이언트 모두에서 액세스할 수 있는 컨테이너가 필요한 개발자는 ReplicatedStorage 대신 사용하는 것이 좋습니다.

코드 샘플

This is a very simple example of how a multiple map system can be made using ServerStorage.

It creates three dummy models (to take the place of maps), that are parented to ServerStorage. Then, it will load a random map (different to the previous map) and wait a specified duration on a loop.

Developers wishing to integrate something similar into their games should consider measures to ensure players respawn correctly, or go to a lobby during intermission periods.

ServerStorage Map Rotation

local ServerStorage = game:GetService("ServerStorage")
local ROUND_TIME = 5
local map1 = Instance.new("Model")
map1.Name = "Map1"
map1.Parent = ServerStorage
local map2 = Instance.new("Model")
map2.Name = "Map2"
map2.Parent = ServerStorage
local map3 = Instance.new("Model")
map3.Name = "Map3"
map3.Parent = ServerStorage
local maps = { map1, map2, map3 }
local RNG = Random.new()
local currentMap = nil
local lastPick = nil
while true do
print("New map!")
-- remove current map
if currentMap then
currentMap:Destroy()
end
-- pick a map
local randomPick = nil
if #maps > 1 then
repeat
randomPick = RNG:NextInteger(1, #maps)
until randomPick ~= lastPick
lastPick = randomPick
end
-- fetch new map
local map = maps[randomPick]
currentMap = map:Clone()
currentMap.Parent = workspace
task.wait(ROUND_TIME)
end

속성

메서드

이벤트