Roblox UtilitiesDevlHub Roblox Documentation

Class

StudioService

NotCreatableServiceNotReplicated
Inherits
Instance › Object
Memory category
Instances

Provides access to configuration of Roblox Studio and allows importing files from the user's file system.

StudioService provides access to configuration of Roblox Studio, allows importing files from the user's file system, and other miscellaneous information. It is intended to be used by Plugins in order to provide a consistent user experience.

Properties 10#

ActiveScriptInstanceReflects the LuaSourceContainer currently being edited (if any).ReadSafeReadOnlyNotReplicated
DraggerSolveConstraintsbooleanReflects whether Studio's draggers solve constraints while moving objects.ReadSafeReadOnlyNotReplicated
DrawConstraintsOnTopbooleanDeprecated property that previously controlled whether constraints were drawn on top of other objects in the viewport.ReadSafeDeprecatedReadOnlyNotReplicated
GridSizefloatDetermines the distance in studs by which Studio's drag and move tools move objects each tick.ReadSafeReadOnlyNotReplicated
RotateIncrementfloatDetermines the degrees by which Studio's rotation tool will rotate selected objects each tick.ReadSafeReadOnlyNotReplicated
SecretsstringA JSON string storing the local secrets for the current experience, used by Studio to support HttpService:GetSecret().Read: RobloxScriptSecurityWrite: RobloxScriptSecurityReadSafe
ShowConstraintDetailsbooleanReflects whether constraint details are drawn in the 3D viewport.ReadSafeReadOnlyNotReplicated
ShowWeldDetailsbooleanReflects whether weld details are drawn in the 3D viewport.Read: RobloxScriptSecurityWrite: RobloxScriptSecurityReadSafeReadOnlyNotReplicated
StudioLocaleIdstringThe locale currently in-use by Studio, e.g. en_US.ReadSafeReadOnlyNotReplicated
UseLocalSpacebooleanDetermines whether Studio tools will use local space of an object or global space.ReadSafeNotReplicated

ActiveScript: Instance#

ReadOnlyNotReplicatedReadSafe

ActiveScript refers to the LuaSourceContainer currently being edited by the user. If the user is not editing a script, this will be nil. Below is an example that shows how you can use this property to measure for how long a script was active.

DraggerSolveConstraints: boolean#

ReadOnlyNotReplicatedReadSafe

Reflects whether Studio's move, scale, and rotate draggers solve constraints while dragging, so that manipulating one part of a constrained mechanism moves the connected parts according to their constraints. This property is read-only and defaults to false. Plugins that implement their own dragging tools can read it to match the user's current dragger behavior.

DrawConstraintsOnTop: boolean#

ReadOnlyNotReplicatedDeprecatedReadSafeDeprecated

Deprecated. This property is deprecated; constraints can no longer be drawn "on top" of other objects.

This property is deprecated and no longer has any effect: constraints can no longer be drawn "on top" of other objects in the 3D viewport.

GridSize: float#

ReadOnlyNotReplicatedReadSafe

GridSize determines the distance in studs by which Studio's drag and move tools move objects each tick. This is set in the user's toolbar's Model tab.

RotateIncrement: float#

ReadOnlyNotReplicatedReadSafe

RotateIncrement determines the angle in degrees by which Studio's rotation tool will rotate selected objects each tick. This is set in the user's toolbar's Model tab.

Secrets: string#

Read: RobloxScriptSecurityWrite: RobloxScriptSecurityReadSafe

Secrets stores the local secrets configured for the current experience. This property is not accessible to creators; secrets are consumed at runtime through HttpService:GetSecret().

ShowConstraintDetails: boolean#

ReadOnlyNotReplicatedReadSafe

Reflects whether Studio draws constraint details in the 3D viewport, mirroring the Constraint Details toggle in the toolbar's Model tab. When enabled, constraints such as WeldConstraints and NoCollisionConstraints are drawn and become selectable in the viewport. This property is read-only and defaults to false.

ShowWeldDetails: boolean#

ReadOnlyNotReplicatedRead: RobloxScriptSecurityWrite: RobloxScriptSecurityReadSafe

Reflects whether Studio draws weld details in the 3D viewport. When enabled, WeldConstraints between parts are visualized. This property is read-only and defaults to false.

StudioLocaleId: string#

ReadOnlyNotReplicatedReadSafe

The StudioLocaleId property contains the locale currently in-use by Studio, e.g. en_US. It is useful when localizing plugins.

Below is a trivial example of localization based on the value returned by this function.

UseLocalSpace: boolean#

NotReplicatedReadSafe

UseLocalSpace determines whether the Studio movement/rotation tools will manipulate a part's CFrame using the local space of an object or global space. By default, this setting is toggled with CtrlL or ⌘L. Plugins can read from this property if they implement their own object movement tools.

Methods 6#

GetClassIconProvides a dictionary that allows the display of a class' Explorer window icon.PluginSecurity security
GetUserIdReturns the Studio user's userId if they're logged in, otherwise returns 0.PluginSecurity security
PromptImportFilePrompts the current Studio user to select one file to add as a File.PluginSecurity securityYields
PromptImportFileAsyncPrompts the current Studio user to select one file to add as a File.PluginSecurity securityYields
PromptImportFilesPrompts the current Studio user to select files to add as Files.PluginSecurity securityYields
PromptImportFilesAsyncPrompts the current Studio user to select files to add as Files.PluginSecurity securityYields

GetClassIcon(className: string): Dictionary#

PluginSecurity security

GetClassIcon provides a dictionary that allows the display of a class' Explorer window icon, e.g. calling this function with "Part" returns property values that display the part icon from the Explorer window.

Below is a literal table representation of the value returned when this function is called with "Part".

Code
{
	Image = "rbxasset://textures/ClassImages.png",
	ImageRectOffset = Vector2.new(16, 0),
	ImageRectSize = Vector2.new(16, 16)
}

The utility function below may prove useful when displaying class icons:

Luau
local StudioService = game:GetService("StudioService")
local imageLabel = script.Parent
local function displayClassIcon(image, className)
	for k, v in StudioService:GetClassIcon(className) do
		image[k] = v -- Set property
	end
end
displayClassIcon(imageLabel, "Part")
NameTypeDefaultDescription
classNamestringThe name of the Roblox class to retrieve the Explorer window icon for.
Returns
  • Dictionary — A dictionary containing Image, ImageRectOffset, and ImageRectSize fields that can be applied to an ImageLabel to display the class icon.

GetUserId(): int64#

PluginSecurity security

Returns the Studio user's userId if they're logged in, otherwise returns 0.

Returns
  • int64 — The UserId of the logged-in Studio user, or 0 if the user is not logged in.

PromptImportFile(fileTypeFilter: Array = {}): Instance#

YieldsDeprecatedPluginSecurity security

This function prompts the current Studio user to select one file, which will then be loaded as a File.

See also:

NameTypeDefaultDescription
fileTypeFilterArray{}A list of file types that the user is allowed to select. File types are formatted without a period. For example, {"jpg", "png"} would allow only a JPG or PNG file to be selected. If no filter is provided, the filter is nil and allows the user to select any file type.
Returns
  • Instance — The imported File. Returns nil if no files were selected, or if the selected file was too large (FileSize greater than 100 megabytes).

PromptImportFileAsync(fileTypeFilter: Array = {}): Instance#

YieldsPluginSecurity security

This function prompts the current Studio user to select one file, which will then be loaded as a File.

See also:

NameTypeDefaultDescription
fileTypeFilterArray{}A list of file types that the user is allowed to select. File types are formatted without a period. For example, {"jpg", "png"} would allow only a JPG or PNG file to be selected. If no filter is provided, the filter is nil and allows the user to select any file type.
Returns
  • Instance — The imported File. Returns nil if no files were selected, or if the selected file was too large (FileSize greater than 100 megabytes).

PromptImportFiles(fileTypeFilter: Array = {}): Instances#

YieldsDeprecatedPluginSecurity security

This function prompts the current Studio user to select one or more files, which will then be loaded as Files.

Throws an error if the fileTypeFilter was an empty list.

See also:

NameTypeDefaultDescription
fileTypeFilterArray{}A list of file types that the user is allowed to select. File types are formatted without a period. For example, {"jpg", "png"} would allow only JPG and PNG files to be selected. If no filter is provided, the filter is nil and allows the user to select any file type.
Returns
  • Instances — The imported Files. Returns an empty list if no files were selected. Returns nil if the user selected one or more files that were too large (FileSize greater than 100 megabytes).

PromptImportFilesAsync(fileTypeFilter: Array = {}): Instances#

YieldsPluginSecurity security

This function prompts the current Studio user to select one or more files, which will then be loaded as Files.

Throws an error if the fileTypeFilter was an empty list.

See also:

NameTypeDefaultDescription
fileTypeFilterArray{}A list of file types that the user is allowed to select. File types are formatted without a period. For example, {"jpg", "png"} would allow only JPG and PNG files to be selected. If no filter is provided, the filter is nil and allows the user to select any file type.
Returns
  • Instances — The imported Files. Returns an empty list if no files were selected. Returns nil if the user selected one or more files that were too large (FileSize greater than 100 megabytes).

Inherited members#

Inherited from Instance 58
Inherited from Object 6
Properties (2)

ClassName, className

Events (1)

Changed