Service · inherits Instance
StudioService
Provides access to configuration of Roblox Studio and allows importing files from the user's file system.
About StudioService
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 7
ActiveScript
: InstanceReadOnlyNotReplicatedReflects theLuaSourceContainercurrently being edited (if any).ActiveScript refers to the
LuaSourceContainercurrently being edited by the user. If the user is not editing a script, this will benil. Below is an example that shows how you can use this property to measure for how long a script was active.DraggerSolveConstraints
: booleanReadOnlyNotReplicatedReflects whether Studio's draggers solve constraints while moving objects.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.GridSize
: floatReadOnlyNotReplicatedDetermines the distance in studs by which Studio's drag and move tools move objects each tick.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
: floatReadOnlyNotReplicatedDetermines the degrees by which Studio's rotation tool will rotate selected objects each tick.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.
ShowConstraintDetails
: booleanReadOnlyNotReplicatedReflects whether constraint details are drawn in the 3D viewport.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
WeldConstraintsandNoCollisionConstraintsare drawn and become selectable in the viewport. This property is read-only and defaults tofalse.StudioLocaleId
: stringReadOnlyNotReplicatedThe locale currently in-use by Studio, e.g.en_US.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
: booleanNotReplicatedDetermines whether Studio tools will use local space of an object or global space.UseLocalSpace determines whether the Studio movement/rotation tools will manipulate a part's
CFrameusing 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 4
GetClassIcon
(className: string) → DictionaryPluginProvides a dictionary that allows the display of a class' Explorer window icon.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")GetUserId
() → int64PluginReturns the Studio user's userId if they're logged in, otherwise returns 0.PromptImportFileAsync
(fileTypeFilter: Array = {}) → InstanceYieldsPluginPrompts the current Studio user to select one file to add as aFile.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
PromptImportFilesAsync
(fileTypeFilter: Array = {}) → InstancesYieldsPluginPrompts the current Studio user to select files to add asFiles.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
StudioService also has every member of Instance. Deprecated and Roblox-only members are hidden.
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.