Class
StudioService
NotCreatableServiceNotReplicated
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.
- Plugins that allow the user to move objects may find
GridSize,RotateIncrementandUseLocalSpaceuseful. - Plugins that require the user to import files should use
PromptImportFileAsyncorPromptImportFilesAsyncin order to receiveFileobjects. - Plugins that display icons of Instance classes can use
GetClassIcon. - Plugins that care about which script is currently being edited (if any) can
read this from
ActiveScript.
Properties 10#
ActiveScriptInstance | Reflects the LuaSourceContainer currently being edited (if any).ReadSafeReadOnlyNotReplicated |
DraggerSolveConstraintsboolean | Reflects whether Studio's draggers solve constraints while moving objects.ReadSafeReadOnlyNotReplicated |
DrawConstraintsOnTopboolean | Deprecated property that previously controlled whether constraints were drawn on top of other objects in the viewport.ReadSafeDeprecatedReadOnlyNotReplicated |
GridSizefloat | Determines the distance in studs by which Studio's drag and move tools move objects each tick.ReadSafeReadOnlyNotReplicated |
RotateIncrementfloat | Determines the degrees by which Studio's rotation tool will rotate selected objects each tick.ReadSafeReadOnlyNotReplicated |
Secretsstring | A JSON string storing the local secrets for the current experience, used by Studio to support HttpService:GetSecret().Read: RobloxScriptSecurityWrite: RobloxScriptSecurityReadSafe |
ShowConstraintDetailsboolean | Reflects whether constraint details are drawn in the 3D viewport.ReadSafeReadOnlyNotReplicated |
ShowWeldDetailsboolean | Reflects whether weld details are drawn in the 3D viewport.Read: RobloxScriptSecurityWrite: RobloxScriptSecurityReadSafeReadOnlyNotReplicated |
StudioLocaleIdstring | The locale currently in-use by Studio, e.g. en_US.ReadSafeReadOnlyNotReplicated |
UseLocalSpaceboolean | Determines 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#
| GetClassIcon | Provides a dictionary that allows the display of a class' Explorer window icon.PluginSecurity security |
| GetUserId | Returns the Studio user's userId if they're logged in, otherwise returns 0.PluginSecurity security |
| PromptImportFile | Prompts the current Studio user to select one file to add as a
File.PluginSecurity securityYields |
| PromptImportFileAsync | Prompts the current Studio user to select one file to add as a
File.PluginSecurity securityYields |
| PromptImportFiles | Prompts the current Studio user to select files to add as
Files.PluginSecurity securityYields |
| PromptImportFilesAsync | Prompts 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".
{
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:
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")| Name | Type | Default | Description |
|---|---|---|---|
className | string | The name of the Roblox class to retrieve the Explorer window icon for. |
Returns
Dictionary— A dictionary containingImage,ImageRectOffset, andImageRectSizefields that can be applied to anImageLabelto 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:
StudioService:PromptImportFiles(), the same function but for loading a list of files instead of a single file
| Name | Type | Default | Description |
|---|---|---|---|
fileTypeFilter | Array | {} | 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. |
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:
StudioService:PromptImportFilesAsync(), the same function but for loading a list of files instead of a single file
| Name | Type | Default | Description |
|---|---|---|---|
fileTypeFilter | Array | {} | 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. |
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:
StudioService:PromptImportFilesAsync(), the same function but for loading a list of files instead of a single file
| Name | Type | Default | Description |
|---|---|---|---|
fileTypeFilter | Array | {} | 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 importedFiles. Returns an empty list if no files were selected. Returnsnilif 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:
StudioService:PromptImportFileAsync(), the same function but for loading a single file instead of a list of files
| Name | Type | Default | Description |
|---|---|---|---|
fileTypeFilter | Array | {} | 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 importedFiles. Returns an empty list if no files were selected. Returnsnilif the user selected one or more files that were too large (FileSize greater than 100 megabytes).
Inherited members#
Inherited from Instance 58
Properties (10)
Archivable, archivable, Capabilities, IsInSandbox, Name, Parent, PredictionMode, RobloxLocked, Sandboxed, UniqueId
Methods (39)
AddTag, children, ClearAllChildren, Clone, clone, Destroy, destroy, FindFirstAncestor, FindFirstAncestorOfClass, FindFirstAncestorWhichIsA, FindFirstChild, findFirstChild, FindFirstChildOfClass, FindFirstChildWhichIsA, FindFirstDescendant, GetActor, GetAttribute, GetAttributeChangedSignal, GetAttributes, GetChildren, getChildren, GetDebugId, GetDescendants, GetFullName, GetStyled, GetStyledPropertyChangedSignal, GetTags, HasTag, IsAncestorOf, IsDescendantOf, isDescendantOf, IsPropertyModified, QueryDescendants, Remove, remove, RemoveTag, ResetPropertyToDefault, SetAttribute, WaitForChild