ReplicatedFirst

非推奨を表示

*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。

作成できません
サービス

コンテンツがすべてのクライアントにレプリケートされる(しかし、サーバーに戻る前)最初のコンテナ。

ReplicatedFirst は何のためですか?

ReplicatedFirst は、ゲームの開始に不可欠な LocalScripts および他のオブジェクトを保存するのに最もよく使用されます。ReplicatedFirst のコンテンツがゲームの他の何よりも先にクライアントにレプリケートするため、ロード中のGUI またはチュートリアルを作成するのに最適です。

最初に複製する必要がないオブジェクトの場合、開発者は ReplicatedStorage コンテナを代わりに使用する必要があります。

ReplicatedFirst をどのように使用できますか?

LocalScripts ReplicatedFirst 内に配置されたものが実行されます。これは、カスタムロードスクリーンやその他の ReplicatedFirst の使用を最も早期に可能な時点で実行できるコードを意味します。

ReplicatedFirst で LocalScripts を実行するときに開発者が覚えておく必要のある複数の重要な考慮事項があります。

  • ゲーム内の他のものよりも前にコンテンツが複製され、LocalScripts で実行されている ReplicatedFirst で必要なオブジェクトを複製するには、Instance:WaitForChild() を使用して複製する必要があります
  • ReplicatedFirst で使用されるすべてのオブジェクトは、また ReplicatedFirst に親属する必要があります。そうでないと、クライアントに遅れて複製し、スクリプトを生成し、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.

Custom Loading Screen

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秒後に削除されます。

開発者は、Class.LocalScript``Class.ReplicatedFirst 、スクリプトは、ReplicatedFirst

開発者が代替として自分のロード画面を表示したい場合を除き、デフォルトのロード画面を削除することはお勧めしません。デフォルトの画面が削除されても、交換ユーザーがいない場合、バックグラウンドでジオメトリのロードが見えるようになります。


戻り値

()

コードサンプル

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.

Custom Loading Screen

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()

イベント