데이터 모델(일반적으로 액세스하는 전역 변수 이후에 알려진 데이터 모델)은 Roblox의 부모-자식 계층의 루트입니다.직접 자식은 Roblox 게임의 기본 구성 요소로 작용하는 서비스, 예를 들어 Workspace 및 Lighting ,입니다.
코드 샘플
Demonstrates using game, the root instance of DataModel, to get services such as Workspace and Lighting.
local Workspace = game:GetService("Workspace")
local Lighting = game:GetService("Lighting")
-- Examples of modifying properties of these services
Workspace.Gravity = 20
Lighting.ClockTime = 4
요약
속성
플레이스소유하는 사용자 또는 그룹의 ID를 설명합니다.
플레이스Enum.CreatorType를 설명하며, 장소가 사용자 또는 그룹에 소유되었는지 여부를 설명합니다.
서버에서 실행 중인 장소가 속한 경험의 ID를 설명합니다.
기능적이지 않음. 역사적으로 장소의 Enum.Genre를 Roblox 웹사이트에 설정된 것으로 묘사했습니다.
실행 중인 게임 서버 인스턴스의 고유 식별자.
서버의 플레이어가 매치메이킹으로 처리되는 방식을 나타냅니다.
서버에서 실행 중인 장소의 ID를 설명합니다.
서버가 실행 중인 장소의 버전을 설명합니다.
서버가 개인 서버인 경우 서버의 개인 서버 ID 또는 reserved server 를 설명합니다.
서버가 비공개인 경우 비공개 서버를 소유하는 의 설명입니다.
Workspace 서비스에 대한 참조.
메서드
서버가 종료되기 전에 호출할 함수를 바인딩합니다.
태스크 스케줄러에서 수행한 작업에 대한 기본 정보가 포함된 테이블을 반환합니다.
지정된 콘텐츠 URL과 연결된 배열 Instances를 반환합니다.
클라이언트가 처음으로 게임을 로드하는 것을 완료했는지 여부에 따라 반환합니다. true를 반환합니다.
현재 게임 인스턴스의 DataModel.PlaceId를 지정된 placeId로 설정합니다.
현재 게임 인스턴스의 DataModel.GameId를 지정된 universId로 설정합니다.
지정된 className에 의해 이미 생성된 경우 지정된 서비스를 반환하고 유효하지 않은 이름에 대한 오류를 발생시킵니다.
요청한 클래스 이름으로 서비스를 반환하고, 존재하지 않으면 생성합니다.
이벤트
사용자가 프롬프트할 때 발생하며 핫키를 사용하여 그래픽 품질을 높이거나 낮춥니다.
게임이 처음으로 로드되는 동안 클라이언트에서 발생하는 화재.
현재 장소가 종료될 때 발화합니다.
서비스가 생성될 때 해고됩니다.
서비스가 제거될 때 발사됩니다.
속성
CreatorId
이 속성은 플레이스소유하는 사용자 또는 그룹의 ID를 설명합니다.DataModel.CreatorType 속성이 *'사용자'*인 경우 CreatorId는 플레이스소유자의 Player.UserId가 됩니다.만약 DataModel.CreatorType 가 '그룹' 이면 CreatorId는 플레이스소유하는 그룹의 ID가 됩니다.
코드 샘플
This code sample will print an output when the user that owns the game, or a member of the group that owns the game joins the server.
To run this script, place it inside a Script in ServerScriptService
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
if game.CreatorType == Enum.CreatorType.User then
if player.UserId == game.CreatorId then
print("The place owner has joined the game!")
end
elseif game.CreatorType == Enum.CreatorType.Group then
if player:IsInGroup(game.CreatorId) then
print("A member of the group that owns the place has joined the game!")
end
end
end)
CreatorType
이 속성은 플레이스Enum.CreatorType를 설명하며, 장소가 사용자 또는 그룹에 소유되었는지 여부를 설명합니다.
Enum.CreatorType 가 '사용자' 인 경우, DataModel.CreatorId 속성은 게임을 소유하는 계정의 UserId 을 설명합니다.CreatorType가 *'그룹'*이면 그룹 ID를 설명합니다.
코드 샘플
This code sample will print an output when the user that owns the game, or a member of the group that owns the game joins the server.
To run this script, place it inside a Script in ServerScriptService
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
if game.CreatorType == Enum.CreatorType.User then
if player.UserId == game.CreatorId then
print("The place owner has joined the game!")
end
elseif game.CreatorType == Enum.CreatorType.Group then
if player:IsInGroup(game.CreatorId) then
print("A member of the group that owns the place has joined the game!")
end
end
end)
Environment
GameId
이 속성은 서버에서 실행 중인 장소가 속하는 경험의 ID를 설명합니다.
또한 참조하세요
- DataModel.PlaceId , 서버에서 실행 중인 장소의 ID를 설명하는 것
- DataModel.JobId , 실행 중인 서버 게임 인스턴스의 고유 식별자
- TeleportService , 게임 간에 Players 를 전송하는 데 사용할 수 있는 서비스
Genre
이 속성은 부서져 있으며 사용되지 않아야 합니다.
이 속성은 역사적으로 장소의 Enum.Genre를 Roblox 웹사이트에 설정된 것으로 묘사했습니다.
이 속성과 , 더 이상 음악 장르가 반영되지 않는 Roblox 웹사이트의 장르로 인해 더 이상 올바르게 기능하지 않습니다.결과적으로 이 속성을 읽으려는 시도는 오류를 발생시킬 수 있습니다.
JobId
이 속성은 실행 중인 게임 서버 인스턴스의 고유 식별자입니다.전 세계적으로 고유한 식별자(UUID)이므로 과거나 현재의 두 서버가 동일한 ID를 가질 수 없습니다.
Studio에서 빈 문자열로 기본값을 설정합니다.
또한 참조하세요
- TeleportService:GetPlayerPlaceInstanceAsync() 사용자의 현재 서버의 DataModel.JobId를 검색하는 데 사용할 수 있는 것.
- TeleportService:TeleportToPlaceInstance() 특정 서버로 텔레포트할 수 있는 Player 을 사용할 수 있습니다.
- DataModel.PrivateServerId 게임 서버 인스턴스가 속한 개인 서버의 ID를 설명합니다.
- HttpService:GenerateGUID() , 자신의 UUID를 생성하는 데 사용할 수 있는 함수.
MatchmakingType
이 속성은 서버의 플레이어가 매치메이킹으로 처리되는 방식을 나타냅니다.다른 MatchmakingTypes 를 가진 플레이어는 동일한 서버에 있거나 순간이동할 수 없습니다.
이 속성은 서버에서만 유효하며 모든 클라이언트에 대한 값이므로 서버 내 속성만 참조하십시오.
PlaceId
이 속성은 서버에서 실행 중인 장소의 ID를 설명합니다.
장소가 Roblox에 게시되지 않았다면 이 ID는 사용 중인 템플릿과 일치합니다.
또한 참조하세요
- DataModel.GameId , 현재 장소가 속한 경험의 ID를 설명하는 것
- DataModel.JobId , 실행 중인 서버 게임 인스턴스의 고유 식별자
- TeleportService , 장소 간에 Players 를 전송할 수 있는 서비스
PlaceVersion
이 속성은 서버가 실행되는 장소의 버전을 설명합니다.
이 버전 번호는 장소 설정의 버전 기록 섹션에 표시된 버전 번호와 일치합니다.Roblox 클라이언트의 현재 버전이 아닙니다.이 속성은 게시되지 않은 모든 경험에 대해 0입니다.
플레이스대한 서버 인스턴스가 생성되면 플레이스현재 버전을 사용합니다.이 서버가 실행되는 동안 장소가 나중에 업데이트되면 서버는 현재 버전으로 유지됩니다.
이 속성을 사용하여 디버깅을 돕기 위해 현재 버전의 게임을 ScreenGui 표시하는 Players를 표시할 수 있습니다.
코드 샘플
This code sample will place a simple GUI in the StarterGui showing the place version the server is running at.
To use this sample, place it inside a Script in ServerScriptService.
local StarterGui = game:GetService("StarterGui")
local versionGui = Instance.new("ScreenGui")
local textLabel = Instance.new("TextLabel")
textLabel.Position = UDim2.new(1, -10, 1, 0)
textLabel.AnchorPoint = Vector2.new(1, 1)
textLabel.Size = UDim2.new(0, 150, 0, 40)
textLabel.BackgroundTransparency = 1
textLabel.TextColor3 = Color3.new(1, 1, 1)
textLabel.TextStrokeTransparency = 0
textLabel.TextXAlignment = Enum.TextXAlignment.Right
textLabel.TextScaled = true
local placeVersion = game.PlaceVersion
textLabel.Text = string.format("Server version: %s", placeVersion)
textLabel.Parent = versionGui
versionGui.Parent = StarterGui
PrivateServerId
이 속성은 서버가 개인 서버인 경우 서버의 개인 서버 ID를 설명합니다.
서버가 개인 서버가 아니면 이 속성은 빈 문자열이 됩니다.
개인 서버
개인 서버는 팔로잉참조합니다:
- 예약된 서버, 개발자가 TeleportService:ReserveServer()를 사용하여 만든 개인 서버
개인 서버 ID vs 작업 ID
서버의 PrivateServerId는 DataModel.JobId 와 다릅니다. 현재 서버 인스턴스의 고유 식별자는 JobId 입니다.
개인 서버(개인 또는 예약 서버)는 시간이 지남에 따라 여러 서버 인스턴스와 연결될 수 있습니다.이는 비공개 서버에서 한 번에 한 개의 서버 인스턴스만 실행될 수 있지만, 새 서버 인스턴스가 플레이어가 게임에 참여하고 게임을 떠날 때 열고 닫을 수 있기 때문입니다.예를 들어, 서버에서 아무도 플레이하지 않을 때 서버 인스턴스가 실행되지 않습니다.PrivateServerId는 이러한 모든 서버 인스턴스에서 일관되며, DataModel.JobId는 각각 고유합니다.
참조하세요:
- DataModel.PrivateServerOwnerId , 개인 서버의 소유자를 설명하는 속성
- TeleportService:ReserveServer() , 예약된 서버를 만드는 함수
코드 샘플
DataModel.PrivateServerId and DataModel.PrivateServerOwnerId can be used to detect if the current server instance is a standard server, a VIP server or a reserved server.
local function getServerType()
if game.PrivateServerId ~= "" then
if game.PrivateServerOwnerId ~= 0 then
return "VIPServer"
else
return "ReservedServer"
end
else
return "StandardServer"
end
end
print(getServerType())
PrivateServerOwnerId
이 속성은 서버가 비공개인 경우 소유하는 개인 서버 의 기능을 설명합니다.
서버가 표준 또는 예약 서버인 경우 이 속성은 0으로 설정됩니다.
이 속성은 예를 들어 특정 Player가 개인 서버의 소유자인지 식별하는 데 사용될 수 있습니다.
local Players = game:GetService("Players")
-- 이것이 개인 서버인가요?
if game.PrivateServerId ~= "" and game.PrivateServerOwnerId ~= 0 then
-- 새로 추가되는 플레이어를 감지하기
Players.PlayerAdded:Connect(function(player)
-- 플레이어가 서버 소유자인지 확인
if player.UserId == game.PrivateServerOwnerId then
print("The private server owner has joined the game")
end
end)
end
참조하세요:
- DataModel.PrivateServerId , 개인 및 reserved servers의 고유 ID를 설명하는 속성
코드 샘플
DataModel.PrivateServerId and DataModel.PrivateServerOwnerId can be used to detect if the current server instance is a standard server, a VIP server or a reserved server.
local function getServerType()
if game.PrivateServerId ~= "" then
if game.PrivateServerOwnerId ~= 0 then
return "VIPServer"
else
return "ReservedServer"
end
else
return "StandardServer"
end
end
print(getServerType())
메서드
BindToClose
서버가 종료되기 전에 호출할 함수를 바인딩합니다.바인딩된 함수가 매개변수를 수락하면 Enum.CloseReason 서버 종료의 이유를 지정하는 매개변수를 전달합니다.
여러 함수를 반복적으로 호출하여 BindToClose()로 바인딩할 수 있습니다. 바인딩된 함수는 병렬로 호출되고 동시에 실행됩니다.
경험 서버는 종료하기 전에 모든 바인딩된 함수가 실행을 중지하기까지 30초 동안 대기합니다.30초 후에는 함수가 여전히 실행 중이더라도 서버가 종료됩니다.
현재 세션이 Roblox Studio에 없는지 확인하려면 RunService:IsStudio()를 사용하십시오.이로 인해 바인딩된 함수가 오프라인 테스트 세션에서 실행을 완료하지 못합니다.
DataStoreService 를 사용할 때 모든 저장되지 않은 데이터를 BindToClose 에 저장하는 함수를 바인딩하려면 DataStores 을 사용해야 합니다.이렇게 하면 서버가 예기치 않게 종료되어도 데이터 손실을 방지할 수 있습니다.
참조하세요:
- 경험 서버 종료의 이유로 Enum.CloseReason입니다.
- PluginGui:BindToClose() , 함수를 PluginGui 닫기 버튼에 바인딩하는 것.
매개 변수
경험 서버가 종료되기 전에 호출되는 함수.바인딩된 함수가 매개변수를 수락하면 Enum.CloseReason 서버 종료의 이유를 지정하는 매개변수를 전달합니다.
반환
코드 샘플
The following code sample is an example of how DataModel:BindToClose() can be used to save player data in the event of a server shutdown. In this example, player data is stored in a dictionary named playerData with UserIds as keys.
local DataStoreService = game:GetService("DataStoreService")
local RunService = game:GetService("RunService")
local playerDataStore = DataStoreService:GetDataStore("PlayerData")
local allPlayerSessionDataCache = {}
local function savePlayerDataAsync(userId, data)
return playerDataStore:UpdateAsync(userId, function(oldData)
return data
end)
end
local function onServerShutdown(closeReason)
if RunService:IsStudio() then
-- Avoid writing studio data to production and stalling test session closing
return
end
-- Reference for yielding and resuming later
local mainThread = coroutine.running()
-- Counts up for each new thread, down when the thread finishes. When 0 is reached,
-- the individual thread knows it's the last thread to finish and should resume the main thread
local numThreadsRunning = 0
-- Calling this function later starts on a new thread because of coroutine.wrap
local startSaveThread = coroutine.wrap(function(userId, sessionData)
-- Perform the save operation
local success, result = pcall(savePlayerDataAsync, userId, sessionData)
if not success then
-- Could implement a retry
warn(string.format("Failed to save %d's data: %s", userId, result))
end
-- Thread finished, decrement counter
numThreadsRunning -= 1
if numThreadsRunning == 0 then
-- This was the last thread to finish, resume main thread
coroutine.resume(mainThread)
end
end)
-- This assumes playerData gets cleared from the data table during a final save on PlayerRemoving,
-- so this is iterating over all the data of players still in the game that hasn't been saved
for userId, sessionData in pairs(allPlayerSessionDataCache) do
numThreadsRunning += 1
-- This loop finishes running and counting numThreadsRunning before any of
-- the save threads start because coroutine.wrap has built-in deferral on start
startSaveThread(userId, sessionData)
end
if numThreadsRunning > 0 then
-- Stall shutdown until save threads finish. Resumed by the last save thread when it finishes
coroutine.yield()
end
end
game:BindToClose(onServerShutdown)
The following example prints the close reason to the output. It prints Done after three seconds, and then allows Roblox to shut down the experience server.
The close reason matches one of the values in Enum.CloseReason.
game:BindToClose(function(closeReason)
print(`Closing with reason {closeReason}`)
task.wait(3)
print("Done")
end)
GetJobsInfo
태스크 스케줄러에서 수행한 작업에 대한 기본 정보가 포함된 테이블을 반환합니다.
계산에서 작업 일정표는 적절한 간격에서 주요 작업을 실행하는 시스템입니다.
Roblox Studio의 작업 일정표 창에서 라이브 작업 일정자 통계도 찾을 수 있습니다.
테이블에서 반환된 첫 번째 항목은 사용 가능한 통계(또는 제목)를 포함하는 참조 사전입니다. 다음 형식입니다:
{["name"] = "name",["averageDutyCycle"] = "averageDutyCycle",["averageStepsPerSecond"] = "averageStepsPerSecond",["averageStepTime"] = "averageStepTime",["averageError"] = "averageError",["isRunning"] = "isRunning",}
표에서 반환된 후속 항목은 작업 일정 스케줄러에서 수행한 위의 통계를 포함하는 사전입니다. 예를 들어:
{["name"] = "Heartbeat",["averageDutyCycle"] = 0,["averageStepsPerSecond"] = 0,["averageStepTime"] = 0,["averageError"] = 0,["isRunning"] = false,}
참조하세요:
반환
태스크 스케줄러에서 수행한 작업에 대한 정보가 포함된 테이블, 위에서 형식을 참조하십시오.
코드 샘플
Here is an example of iterating over the job info.
local jobInfo = game:GetJobsInfo()
local jobTitles = jobInfo[1]
table.remove(jobInfo, 1)
local divider = string.rep("-", 120)
print(divider)
warn("JOB INFO:")
print(divider)
for _, job in pairs(jobInfo) do
for jobIndex, jobValue in pairs(job) do
local jobTitle = jobTitles[jobIndex]
warn(jobTitle, "=", jobValue)
end
print(divider)
end
GetObjects
이 메서드는 지정된 콘텐츠 URL과 연결된 배열 Instances를 반환합니다.Roblox 라이브러리의 콘텐츠를 삽입하는 데 사용할 수 있습니다.이 메서드를 사용하여 Sounds 를 삽입할 수 없으며, 이들에는 Instance 가 연결되어 있지 않고 콘텐츠 URL만 있기 때문입니다.
InsertService:LoadAsset() 와는 달리, DataModel:GetObjects() 는 자산이 "신뢰할 수 있음"을 요구하지 않으며, 즉 자산은 로그인한 사용자가 소유하거나 Roblox가 생성해야만 삽입될 수 있습니다.그러나 로그인한 사용자가 자산을 소유하지 않는 경우 자유롭게 사용할 수 있어야 합니다.
이 함수의 보안 컨텍스트로 인해 플러그인이나 명령줄에서만 사용할 수 있습니다.Scripts 및 LocalScripts에서 사용할 수 있는 대체 방법은 참조하십시오 InsertService:LoadAsset() .
매개 변수
지정된 콘텐츠 URL.
반환
콘텐츠 URL과 연결된 배열 Instances의 배열.
코드 샘플
If you want to view a plugin's source code without installing it, you can use DataModel:GetObjects() to download the plugin. The code sample below includes a function that will take a plugin's website URL and insert the plugin into the currently selected Instance or the Workspace.
Due to GetObjects' security context, this function can only be used in the command line or in a plugin.
local Selection = game:GetService("Selection")
local WEB_URL = "plugin URL here"
local function downloadPlugin(webURL)
-- get the content URL
local contentID = string.match(webURL, "%d+")
local contentURL = "rbxassetid://" .. contentID
-- download the objects
local objects = game:GetObjects(contentURL)
-- decide where to parent them
local selection = Selection:Get()
local parent = #selection == 1 and selection[1] or workspace
-- parent the objects
for _, object in pairs(objects) do
object.Parent = parent
end
end
downloadPlugin(WEB_URL)
The content ID of a Decal on the Roblox website is associated with a Decal Instance rather than the actual content ID of the texture.
The code below, will use DataModel:GetObjects() to insert Decal objects into place and read their Decal.Texture property to obtain the image content IDs.
To use this code sample, enter the web URLs of the decals you'd like to convert into the array named IMAGES (as strings). A dictionary with the converted textures will be outputted.
local IMAGES = {
-- Insert Decal web URLs in an array here (as strings)
}
-- open the dictionary
local outputString = "textures = {"
-- utility function to add a new entry to the dictionary (as a string)
local function addEntryToDictionary(original, new)
outputString = outputString
.. "\n" -- new line
.. " " -- indent
.. '["'
.. original
.. '"]' -- key
.. ' = "'
.. new
.. '",' -- value
end
print("Starting conversion")
for _, webURL in pairs(IMAGES) do
-- get the content URL
local contentID = string.match(webURL, "%d+")
local contentURL = "rbxassetid://" .. contentID
local success, result = pcall(function()
local objects = game:GetObjects(contentURL)
return objects[1].Texture
end)
if success then
addEntryToDictionary(webURL, result)
else
addEntryToDictionary(webURL, "Error downloading decal")
end
task.wait()
end
print("Conversion complete")
-- close the dictionary
outputString = outputString .. "\n}"
-- print the dictionary
print(outputString)
IsLoaded
게임의 모든 초기 Instances가 클라이언트에 복제를 완료했을 때 이 함수는 true를 반환합니다.
부모로 지정되지 않으면 ReplicatedFirst , LocalScripts 게임이 로드될 때까지 실행되지 않습니다.다음 스니펫은 게임이 로드될 때까지 LocalScript에서 실행되며 ReplicatedFirst에서 다음과 같은 결과를 제공합니다:
if not game:IsLoaded() thengame.Loaded:Wait()end
참조하세요:
- 복제 순서 로드 프로세스의 자세한 요약을 위해.
- DataModel.Loaded , 게임이 로드될 때 발생하는 이벤트
- Instance:WaitForChild() , 전체 게임이 로드되기를 기다리지 않고 개별 Instance 가 복제되도록 대기할 수 있는 함수
반환
클라이언트가 처음으로 게임을 로드하는지 여부.
코드 샘플
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()
SetPlaceId
이 함수는 게임 인스턴스의 DataModel.PlaceId를 지정된 placeId로 설정합니다.
장소가 게시되지 않은 경우, 예를 들어 로컬 .rbxl 파일일 때 DataModel.PlaceId 와 DataModel.GameId 을 모두 설정해야 합니다.Setting both and are required to access DataStoreService when the place is unpublished, for example a local file.아래에서 예제를 참조하십시오.Studio에서 API 서비스에 대한 액세스를 획득하려면 DataStoreService 보안 패널의 API 서비스에 대한 Studio 액세스 활성화 설정이 필요합니다.Note that gaining 액세스 from Studio requires the Enable Studio Access to API Services setting from the 보안 panel in 게임 설정 .
local DataStoreService = game:GetService("DataStoreService")-- PlaceId를 플레이스ID로, GameId를 유니버스ID로 설정하여 데이터스토어 '데이터'에 액세스합니다.game:SetPlaceId(placeId)game:SetUniverseId(universeId)local dataStore = DataStoreService:GetDataStore("Data")
매개 변수
DataModel.PlaceId 설정할 ID.
반환
SetUniverseId
이 함수는 현재 게임 인스턴스의 DataModel.GameId를 지정된 universeId로 설정합니다.Roblox에 게시되지 않은 로컬 .rbxl 파일을 테스트할 때 유용합니다.
게시되지 않은 플레이스DataStoreService에 액세스하려면 둘 다 DataModel:SetUniverseId()와 DataModel:SetPlaceId()이 설정되어야 합니다.
매개 변수
DataModel.GameId 설정할 ID.
반환
이벤트
GraphicsQualityChangeRequest
사용자가 핫키를 사용하여 그래픽 품질을 높이거나 낮추도록 요청하면 발생합니다.
이 이벤트는 다음 조건에서 발생합니다:
- 사용자가 F10 를 누르면 이 이벤트는 betterQuality 인수로 true 가 발생합니다.
- 사용자가 ShiftF10 을 누르면 이 이벤트가 betterQuality 인수로 발생합니다.If the user presses , this event fires with a argument of false .
이 이벤트는 현재 그래픽 품질 수준을 제공하지 않거나 그래픽 품질에 대한 모든 업데이트를 다루지 않습니다.예를 들어, 핵심 GUI 이스케이프 메뉴에서 변경된 내용은 등록되지 않습니다.
다음 스니펫을 사용하여 사용자의 를 검색할 수 있습니다.
UserSettings():GetService("UserGameSettings").SavedQualityLevel
사용자의 그래픽 설정이 자동으로 설정되면 Enum.SavedQualitySetting 가 Automatic 됩니다.현재 개발자가 사용자 컴퓨터의 현재 그래픽 품질 수준을 안정적으로 가져올 수 있는 방법은 없습니다.
매개 변수
사용자가 그래픽 품질에 증가(true)나 감소(false)를 요청했는지 여부.
코드 샘플
game.GraphicsQualityChangeRequest:Connect(function(betterQuality)
if betterQuality then
print("The user has requested an increase in graphics quality!")
else
print("The user has requested a decrease in graphics quality!")
end
end)
Loaded
이 이벤트는 게임의 모든 초기 Instances가 클라이언트에 복제를 완료했을 때 클라이언트에서 발생합니다.
부모로 지정되지 않으면 ReplicatedFirst , LocalScripts 게임이 로드될 때까지 실행되지 않습니다.다음 스니펫은 게임이 로드될 때까지 LocalScript에서 실행되며 ReplicatedFirst에서 다음과 같은 결과를 제공합니다:
if not game:IsLoaded() thengame.Loaded:Wait()end
참조하세요:
- 복제 순서 로드 프로세스의 자세한 요약을 위해.
- DataModel.Loaded , 게임이 로드될 때 발생하는 이벤트
- Instance:WaitForChild() , 전체 게임이 로드되기를 기다리지 않고 개별 Instance 가 복제되도록 대기할 수 있는 함수