StudioService

Show Deprecated
Not Creatable
Service
Not Replicated

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.

Summary

Properties

Reflects the LuaSourceContainer currently being edited (if any).

READ ONLY
NOT REPLICATED
READ ONLY
NOT REPLICATED
READ ONLY
NOT REPLICATED

Determines the distance in studs by which studio's drag and move tools move objects each tick.

READ ONLY
NOT REPLICATED

Determines the degrees by which studio's rotation tool will rotate selected objects each tick.

READ ONLY
NOT REPLICATED
READ ONLY
NOT REPLICATED

The locale currently in-use by Studio, e.g. en_US.

READ ONLY
NOT REPLICATED

Determines whether studio tools will use local space of an object or global space.

NOT REPLICATED

Events

Methods

CopyToClipboard(stringToCopy: string): nil  


DEPRECATED_ShowSaveOrPublishPlaceToRoblox(showGameSelect: boolean, isPublish: boolean, closeMode: StudioCloseMode): nil  


DEPRECATED_publishAs(universeId: number, placeId: number, groupId: number): nil  


GetClassIcon(className: string): Dictionary  

Provides a dictionary that allows the display of a class' Explorer window icon.


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

GizmoRaycast(origin: Vector3, direction: Vector3, raycastParams: RaycastParams): RaycastResult  


IsPluginUpToDate(assetId: number, currentAssetVersion: number): boolean  


SetPluginEnabled(assetId: number, state: boolean): nil  


UninstallPlugin(assetId: number): nil  


PromptImportFile(fileTypeFilter: Array): Instance  YIELDS

Prompts the current Studio user to select one file to add as a File.

PromptImportFiles(fileTypeFilter: Array): Objects  YIELDS

Prompts the current Studio user to select files to add as Files.

TryInstallPlugin(assetId: number, assetVersionId: number): nil  YIELDS


Properties

ActiveScript

Read Only
Not Replicated

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.


1local startTime = os.time()
2local activeScript
3local function onActiveScriptChanged(newActiveScript)
4 if newActiveScript ~= activeScript then
5 local deltaTime = os.time() - startTime
6 print(("You edited %s for %d:%2.d"):format(activeScript.Name, math.floor(deltaTime / 60), deltaTime % 60))
7 end
8 startTime = os.time()
9 activeScript = newActiveScript
10end
11game:GetService("StudioService"):GetPropertyChangedSignal("ActiveScript"):Connect(onActiveScriptChanged)
12

DraggerSolveConstraints

Read Only
Not Replicated

DrawConstraintsOnTop

Read Only
Not Replicated

GridSize

Read Only
Not Replicated

GridSize determines the distance in studs by which studio's drag and move tools move objects each tick. This is set by the user Model tab under the "Snap to Grid" section.

Studio "snap to grid" UI

RotateIncrement

Read Only
Not Replicated

RotateIncrement determines the angle in degrees by which studio's rotation tool will rotate selected objects each tick. This is set by the user Model tab under the "Snap to Grid" section.

Studio "snap to grid" UI

The table below shows how the rotation handles appear while dragging. Notice how lower values render more axles. In these images, UseLocalSpace is true.

RotateIncrementImage
22.5
90.0

ShowConstraintDetails

Read Only
Not Replicated

StudioLocaleId

Read Only
Not Replicated

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.


1local locale = game:GetService("StudioService").StudioLocaleId
2if locale == "en_US" then
3 print("Howdy, ya'll")
4elseif locale == "en_GB" then
5 print("'Ello, gov'na")
6elseif locale:sub(1, 2) == "en" then
7 print("Hello")
8elseif locale == "fr_FR" then
9 print("Bonjour")
10end
11

UseLocalSpace

Not Replicated

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 Ctrl-L. Plugins can read from this property if they implement their own object movement tools.

The table below shows how movement/rotation tools change when working with parts. Notice how when UseLocalSpace is false, the movement tools align with the global axes, and when true the movement tools align with the part's local axes.

UseLocalSpaceMovementRotation
true
false

Events

DEPRECATED_GameNameUpdated

Roblox Script Security

Parameters

name: string

DEPRECATED_GamePublishFinished

Roblox Script Security

Parameters

success: boolean
gameId: number

DEPRECATED_OnPublishPlaceToRoblox

Roblox Script Security

Parameters

isOverwritePublish: boolean

DEPRECATED_OnSaveOrPublishPlaceToRoblox

Roblox Script Security

Parameters

showGameSelect: boolean
isPublish: boolean
closeMode: StudioCloseMode

OnImportFromRoblox

Roblox Script Security

OnOpenGameSettings

Roblox Script Security

Parameters

pageIdentifier: string

OnOpenManagePackagePlugin

Roblox Script Security

Parameters

userId: number
assetId: number

OnPluginInstalledFromToolbox

Roblox Script Security

OnPluginInstalledFromWeb

Roblox Script Security

Parameters

pluginId: string

OnPublishAsPlugin

Roblox Script Security

Parameters

instances: Objects

OnSaveToRoblox

Roblox Script Security

Parameters

instances: Objects

PromptTransformPluginCheckEnable

Roblox Script Security

SaveLocallyAsComplete

Roblox Script Security

Parameters

success: boolean

Methods

AnimationIdSelected

Roblox Script Security

Parameters

id: number

Returns

CopyToClipboard

Roblox Script Security

Parameters

stringToCopy: string

Returns

DEPRECATED_EmitPlacePublishedSignal

Roblox Script Security

Returns

DEPRECATED_RefreshDocumentDisplayName

Roblox Script Security

Returns

DEPRECATED_SetUniverseDisplayName

Roblox Script Security

Parameters

newName: string

Returns

DEPRECATED_ShowSaveOrPublishPlaceToRoblox

Roblox Script Security

Parameters

showGameSelect: boolean
isPublish: boolean
closeMode: StudioCloseMode

Returns

DEPRECATED_publishAs

Roblox Script Security

Parameters

universeId: number
placeId: number
groupId: number

Returns

GetBadgeConfigureUrl

Roblox Script Security

Parameters

badgeId: number

Returns

GetBadgeUploadUrl

Roblox Script Security

Returns

GetClassIcon

Plugin 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".


1{
2 Image = "rbxasset://textures/ClassImages.png",
3 ImageRectOffset = Vector2.new(16, 0),
4 ImageRectSize = Vector2.new(16, 16)
5}
6

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


1local StudioService = game:GetService("StudioService")
2local imageLabel = script.Parent
3local function displayClassIcon(image, className)
4 for k, v in pairs(StudioService:GetClassIcon(className)) do
5 image[k] = v -- Set property
6 end
7end
8displayClassIcon(imageLabel, "Part")
9

Parameters

className: string

Returns

GetPlaceIsPersistedToCloud

Roblox Script Security

Returns

GetResourceByCategory

Roblox Script Security

Parameters

category: string

Returns

GetStartupAssetId

Roblox Script Security

Returns

GetStartupPluginId

Roblox Script Security

Returns

GetTermsOfUseUrl

Roblox Script Security

Returns

GetUserId

Plugin Security

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


Returns

Code Samples

StudioService:GetUserId

1-- Can only be used in a plugin
2local StudioService = game:GetService("StudioService")
3local Players = game:GetService("Players")
4
5local loggedInUserId = StudioService:GetUserId()
6local loggedInUserName = Players:GetNameFromUserIdAsync(loggedInUserId)
7print("Hello,", loggedInUserName)

GizmoRaycast

Plugin Security

Parameters

origin: Vector3
direction: Vector3
raycastParams: RaycastParams
Default Value: "RaycastParams{IgnoreWater=false, BruteForceAllSlow=false, CollisionGroup=Default, FilterDescendantsInstances={}}"

HasInternalPermission

Roblox Script Security

Returns

IsPluginInstalled

Roblox Script Security

Parameters

assetId: number

Returns

IsPluginUpToDate

Roblox Script Security

Parameters

assetId: number
currentAssetVersion: number

Returns

OpenInBrowser_DONOTUSE

Roblox Script Security

Parameters

url: string

Returns

RequestClose

Roblox Script Security

Parameters

closeMode: StudioCloseMode

Returns

SetPluginEnabled

Roblox Script Security

Parameters

assetId: number
state: boolean

Returns

ShowPlaceVersionHistoryDialog

Roblox Script Security

Parameters

placeId: number

Returns

ShowPublishToRoblox

Roblox Script Security

Returns

UninstallPlugin

Roblox Script Security

Parameters

assetId: number

Returns

UpdatePluginManagement

Roblox Script Security

Returns

PromptImportFile

Yields
Plugin Security

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

See also:

Parameters

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.

Default Value: "{}"

Returns

The imported File. Returns nil if no files were selected, or if the selected file was too large (FileSize greater than 100 megabytes).

PromptImportFiles

Yields
Plugin 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:

Parameters

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.

Default Value: "{}"

Returns

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).

TryInstallPlugin

Yields
Roblox Script Security

Parameters

assetId: number
assetVersionId: number

Returns