UserSettings

Show Deprecated
Not Creatable

UserSettings is a singleton object that is used to house basic user settings, which persist across all games. Currently, it only stores the UserGameSettings object.

You can retrieve a reference to this object via the UserSettings() function, which returns it.

Code Samples

IsUserFeatureEnabled Sample

1if UserSettings():IsUserFeatureEnabled("UserNoCameraClickToMove") then
2 print("'ClickToMove' should no longer be loaded from the CameraScript!")
3else
4 print("'ClickToMove' is still loaded from the CameraScript!")
5end
UserGameSettings Listener

1local gameSettings = UserSettings().GameSettings
2
3local function onGameSettingChanged(nameOfSetting)
4 -- Fetch the value of this setting through a pcall to make sure we can retrieve it.
5 -- Sometimes the event fires with properties that LocalScripts can't access.
6 local canGetSetting, setting = pcall(function()
7 return gameSettings[nameOfSetting]
8 end)
9
10 if canGetSetting then
11 print("Your " .. nameOfSetting .. " has changed to: " .. tostring(setting))
12 end
13end
14
15gameSettings.Changed:Connect(onGameSettingChanged)
Full Screen Mode Detection

1local gameSettings = UserSettings().GameSettings
2
3local function checkFullScreenMode()
4 local inFullscreen = gameSettings:InFullScreen()
5 if inFullscreen then
6 print("Full Screen mode enabled!")
7 else
8 print("Full Screen mode disabled!")
9 end
10end
11
12checkFullScreenMode()
13gameSettings.FullscreenChanged:Connect(checkFullScreenMode)

Summary

Properties

Events

Methods


Returns true if the specified user feature is enabled. This will throw an error if the user feature does not exist.

Reset(): void  

Erases the saved state of the UserSettings, and restores its default values.

Properties

Events

Methods

IsUserFeatureEnabled

Returns true if the specified user feature is enabled. This will throw an error if the user feature does not exist.

This function checks against a list of FFlags, whose name starts with "User". The function is intended to be used by Roblox-created scripts, and functions similarly to GlobalSettings:GetFFlag().

Parameters

name: string

Returns

Code Samples

IsUserFeatureEnabled Sample

1if UserSettings():IsUserFeatureEnabled("UserNoCameraClickToMove") then
2 print("'ClickToMove' should no longer be loaded from the CameraScript!")
3else
4 print("'ClickToMove' is still loaded from the CameraScript!")
5end

Reset

void

Erases the saved state of the UserSettings, and restores its values back to default. This function will fail to run correctly from a LocalScript, as it does not have permission to restore all of the properties in the UserGameSettings class.


Returns

void