UserGameSettings

顯示已棄用項目

*此內容是使用 AI(Beta 測試版)翻譯,可能含有錯誤。若要以英文檢視此頁面,請按一下這裡

無法建立
使用者設定
未複製

使用者遊戲設定是一個在 UserSettings 單挑內找到的獨立類。它保持各種持久設定,關於使用者如何控制相攝影機和角色。

您可以從 LocalScript 通過以下方式存取此對象:


UserSettings():GetService("UserGameSettings")

這個對象只供客戶使用,因為它在伺服器上沒有用途。在 Roblox Studio 測試時,也會反映您自己的設定。

範例程式碼

A basic example that shows how you can listen to changes in the user's settings. With this code pasted into a LocalScript running in the StarterPlayerScripts, you can change settings in Roblox's game menu, and see their values appear in the output as detected changes.

UserGameSettings Listener

local gameSettings = UserSettings().GameSettings
local function onGameSettingChanged(nameOfSetting)
-- Fetch the value of this setting through a pcall to make sure we can retrieve it.
-- Sometimes the event fires with properties that LocalScripts can't access.
local canGetSetting, setting = pcall(function()
return gameSettings[nameOfSetting]
end)
if canGetSetting then
print("Your " .. nameOfSetting .. " has changed to: " .. tostring(setting))
end
end
gameSettings.Changed:Connect(onGameSettingChanged)

概要

屬性

方法

活動

屬性

AllTutorialsDisabled

Roblox 指令碼安全性
平行讀取
Roblox 指令碼安全性
平行讀取

ChatVisible

Roblox 指令碼安全性
平行讀取

ComputerCameraMovementMode

平行讀取

ComputerMovementMode

平行讀取

ControlMode

平行讀取

Fullscreen

Roblox 指令碼安全性
平行讀取

GamepadCameraSensitivity

平行讀取

GraphicsOptimizationMode

Roblox 指令碼安全性
平行讀取

GraphicsQualityLevel

Roblox 指令碼安全性
平行讀取

HasEverUsedVR

Roblox 指令碼安全性
平行讀取

MasterVolume

Roblox 指令碼安全性
平行讀取

MasterVolumeStudio

Roblox 指令碼安全性
平行讀取

MaxQualityEnabled

Roblox 指令碼安全性
平行讀取

MouseSensitivity

平行讀取

OnboardingsCompleted

Roblox 指令碼安全性
平行讀取

PartyVoiceVolume

Roblox 指令碼安全性
平行讀取

RCCProfilerRecordFrameRate

平行讀取

RCCProfilerRecordTimeFrame

平行讀取

RotationType

平行讀取

SavedQualityLevel

平行讀取

StartMaximized

未複製
無法建立指令碼
Roblox 指令碼安全性
平行讀取

StartScreenPosition

未複製
無法建立指令碼
Roblox 指令碼安全性
平行讀取

StartScreenSize

未複製
無法建立指令碼
Roblox 指令碼安全性
平行讀取

TouchCameraMovementMode

平行讀取

TouchMovementMode

平行讀取

UsedCoreGuiIsVisibleToggle

Roblox 指令碼安全性
平行讀取

UsedCustomGuiIsVisibleToggle

Roblox 指令碼安全性
平行讀取

UsedHideHudShortcut

Roblox 指令碼安全性
平行讀取

VREnabled

Roblox 指令碼安全性
平行讀取

VRRotationIntensity

Roblox 指令碼安全性
平行讀取

VRSmoothRotationEnabled

Roblox 指令碼安全性
平行讀取

VignetteEnabled

Roblox 指令碼安全性
平行讀取

方法

GetCameraYInvertValue


返回

GetOnboardingCompleted

參數

onboardingId: string
預設值:""

返回

InFullScreen


返回

InStudioMode


返回

SetCameraYInvertVisible

()

返回

()

SetGamepadCameraSensitivityVisible

()

返回

()

SetOnboardingCompleted

()

參數

onboardingId: string
預設值:""

返回

()

活動

FullscreenChanged

參數

isFullscreen: boolean

範例程式碼

Full Screen Mode Detection

local gameSettings = UserSettings().GameSettings
local function checkFullScreenMode()
local inFullscreen = gameSettings:InFullScreen()
if inFullscreen then
print("Full Screen mode enabled!")
else
print("Full Screen mode disabled!")
end
end
checkFullScreenMode()
gameSettings.FullscreenChanged:Connect(checkFullScreenMode)

StudioModeChanged

參數

isStudioMode: boolean