다른 모든 것보다 먼저 모든 클라이언트에 콘텐츠가 복제되는 컨테이너(하지만 서버에 다시 복제되지 않음)입니다.
ReplicatedFirst는 무엇을 위한 것입니까?
ReplicatedFirst는 게임의 시작에 필수적인 LocalScripts 및 기타 개체를 저장하는 데 가장 일반적으로 사용됩니다.ReplicatedFirst의 콘텐츠가 게임의 다른 어떤 것보다 먼저 클라이언트에 복제되므로, 로딩 GUI나 튜토리얼을 만드는 데 이상적입니다.
먼저 복제할 필요가 없는 개체의 경우 개발자는 대신 ReplicatedStorage 컨테이너를 사용해야 합니다.
ReplicatedFirst를 어떻게 사용할 수 있나요?
LocalScripts ReplicatedFirst 내에 배치된 것은 실행됩니다.즉, 사용자 지정 로딩 화면이나 다른 ReplicatedFirst 사용의 코드를 가능한 한 빨리 실행할 수 있습니다.
ReplicatedFirst에서 LocalScripts를 실행할 때 개발자가 기억해야 하는 여러 가지 주요 고려 사항이 있습니다.
- 게임의 다른 것보다 콘텐츠가 복제되기 전, 즉 LocalScripts ReplicatedFirst에서 실행되는 개체가 복제하려는 개체를 사용하여 복제해야 하는 경우 Instance:WaitForChild()
- ReplicatedFirst에서 사용될 모든 개체는 LocalScript에 부모로 지정되어야 합니다.그렇지 않으면 클라이언트에 늦게 복제되어 스크립트를 제공하고 ReplicatedFirst의 이점을 무효화할 수 있습니다.
ReplicatedFirst에는 기본 Roblox 로딩 화면을 즉시 제거할 수 있는 함수 ReplicatedFirst:RemoveDefaultLoadingScreen()도 포함됩니다.어떤 개체가 ReplicatedFirst에 배치되었는지 확인하십시오, 기본 로딩 화면은 이 함수가 호출되었는지 여부에 관계없이 5초 후에 제거됩니다.
코드 샘플
This sample demonstrates a custom loading screen with a basic TextLabel. The code should be placed in a LocalScript within ReplicatedFirst. To expand on this sample with loading screen animations, see the Custom Loading Screens article.
local Players = game:GetService("Players")
local ReplicatedFirst = game:GetService("ReplicatedFirst")
local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
-- Create a basic loading screen
local screenGui = Instance.new("ScreenGui")
screenGui.IgnoreGuiInset = true
local textLabel = Instance.new("TextLabel")
textLabel.Size = UDim2.new(1, 0, 1, 0)
textLabel.BackgroundColor3 = Color3.fromRGB(0, 20, 40)
textLabel.Font = Enum.Font.GothamMedium
textLabel.TextColor3 = Color3.new(0.8, 0.8, 0.8)
textLabel.Text = "Loading"
textLabel.TextSize = 28
textLabel.Parent = screenGui
-- Parent entire screen GUI to player GUI
screenGui.Parent = playerGui
-- Remove the default loading screen
ReplicatedFirst:RemoveDefaultLoadingScreen()
--wait(3) -- Optionally force screen to appear for a minimum number of seconds
if not game:IsLoaded() then
game.Loaded:Wait()
end
screenGui:Destroy()
요약
메서드
기본 Roblox 로딩 화면을 즉시 제거합니다.어떤 개체가 ReplicatedFirst에 배치되었는지 확인하고, 기본 로딩 화면은 이 함수가 호출되었는지 여부에 관계없이 5초 후에 제거됩니다.
속성
메서드
RemoveDefaultLoadingScreen
기본 Roblox 로딩 화면을 즉시 제거합니다.어떤 개체가 ReplicatedFirst에 배치되었는지 확인하고, 기본 로딩 화면은 이 함수가 호출되었는지 여부에 관계없이 5초 후에 제거됩니다.
개발자는 스크립트가 다른 것보다 먼저 실행되므로 에서 이 함수를 실행해야 하며, 스크립트는 에서 실행됩니다.
개발자가 자체 로딩 화면을 대체로 표시하려는 경우가 아니면 기본 로딩 화면을 제거하지 않는 것이 좋습니다.기본 화면이 제거되고 대체 사용자가 없으면 배경에서 기하 데이터 로드를 볼 수 있습니다.
반환
코드 샘플
This sample demonstrates a custom loading screen with a basic TextLabel. The code should be placed in a LocalScript within ReplicatedFirst. To expand on this sample with loading screen animations, see the Custom Loading Screens article.
local Players = game:GetService("Players")
local ReplicatedFirst = game:GetService("ReplicatedFirst")
local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
-- Create a basic loading screen
local screenGui = Instance.new("ScreenGui")
screenGui.IgnoreGuiInset = true
local textLabel = Instance.new("TextLabel")
textLabel.Size = UDim2.new(1, 0, 1, 0)
textLabel.BackgroundColor3 = Color3.fromRGB(0, 20, 40)
textLabel.Font = Enum.Font.GothamMedium
textLabel.TextColor3 = Color3.new(0.8, 0.8, 0.8)
textLabel.Text = "Loading"
textLabel.TextSize = 28
textLabel.Parent = screenGui
-- Parent entire screen GUI to player GUI
screenGui.Parent = playerGui
-- Remove the default loading screen
ReplicatedFirst:RemoveDefaultLoadingScreen()
--wait(3) -- Optionally force screen to appear for a minimum number of seconds
if not game:IsLoaded() then
game.Loaded:Wait()
end
screenGui:Destroy()