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.

요약

속성

  • 읽기 전용
    복제되지 않음
    병렬 읽기

    Reflects the LuaSourceContainer currently being edited (if any).

  • 읽기 전용
    복제되지 않음
    병렬 읽기
  • 읽기 전용
    복제되지 않음
    병렬 읽기

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

  • 읽기 전용
    복제되지 않음
    병렬 읽기

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

  • 읽기 전용
    복제되지 않음
    병렬 읽기
  • 읽기 전용
    복제되지 않음
    병렬 읽기

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

  • 복제되지 않음
    병렬 읽기

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

메서드

속성

ActiveScript

읽기 전용
복제되지 않음
병렬 읽기

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.


local startTime = os.time()
local activeScript
local function onActiveScriptChanged(newActiveScript)
if newActiveScript ~= activeScript then
local deltaTime = os.time() - startTime
print(("You edited %s for %d:%2.d"):format(activeScript.Name, math.floor(deltaTime / 60), deltaTime % 60))
end
startTime = os.time()
activeScript = newActiveScript
end
game:GetService("StudioService"):GetPropertyChangedSignal("ActiveScript"):Connect(onActiveScriptChanged)

DraggerSolveConstraints

읽기 전용
복제되지 않음
병렬 읽기

GridSize

읽기 전용
복제되지 않음
병렬 읽기

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 Model tab under the Snap to Grid section.

Transform snapping tools indicated in Model tab

RotateIncrement

읽기 전용
복제되지 않음
병렬 읽기

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 Model tab under the Snap to Grid section.

Transform snapping tools indicated in Model tab

ShowConstraintDetails

읽기 전용
복제되지 않음
병렬 읽기

StudioLocaleId

읽기 전용
복제되지 않음
병렬 읽기

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.


local locale = game:GetService("StudioService").StudioLocaleId
if locale == "en_US" then
print("Howdy, ya'll")
elseif locale == "en_GB" then
print("'Ello, gov'na")
elseif locale:sub(1, 2) == "en" then
print("Hello")
elseif locale == "fr_FR" then
print("Bonjour")
end

UseLocalSpace

복제되지 않음
병렬 읽기

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.

The images below show how movement/rotation tools change when working with parts. 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.

falsetrue
Part draggers in World orientation modePart draggers in Local orientation mode

메서드

GetClassIcon

플러그인 보안

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

매개 변수

className: string

반환

GetUserId

플러그인 보안

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


반환

코드 샘플

StudioService:GetUserId

-- Can only be used in a plugin
local StudioService = game:GetService("StudioService")
local Players = game:GetService("Players")
local loggedInUserId = StudioService:GetUserId()
local loggedInUserName = Players:GetNameFromUserIdAsync(loggedInUserId)
print("Hello,", loggedInUserName)

GizmoRaycast

플러그인 보안

매개 변수

origin: Vector3
direction: Vector3
raycastParams: RaycastParams
기본값: "RaycastParams{IgnoreWater=false, BruteForceAllSlow=false, RespectCanCollide=false, CollisionGroup=Default, FilterDescendantsInstances={}}"

반환

PromptImportFile

생성
플러그인 보안

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

See also:

매개 변수

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.

기본값: "{}"

반환

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

PromptImportFiles

생성
플러그인 보안

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:

매개 변수

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.

기본값: "{}"

반환

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

이벤트