PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

Workspace

Show deprecated

Workspace

Show deprecated

The Workspace is the service in which any objects that are to be rendered in the 3D world exist. Objects not descending from Workspace will not be rendered or physically interact with the world.

What does the Workspace do?

The core job of the Workspace is to hold objects that exist in the 3D world, BasePart|BaseParts and Attachment|Attachments. Whilst such objects are descendant of Workspace, they will be active. For BaseParts this means they will be rendered, and physically interact with other parts and the world. For Attachments this means objects adorned to them, such as ParticleEmitter|ParticleEmitters, Beam|Beams and BillboardGui|BillboardGuis will render.

Understanding this behavior is important, as it means objects can be removed from the Workspace when they are not needed. For example, map Model|Models can be removed from the Workspace when a different map is being played on. Objects that are not immediately needed in the Workspace are generally stored in ReplicatedStorage or ServerStorage.

In its role as the holder of active 3D objects, Workspace includes a number of useful functions related to parts, their positions and joints between them. Commonly used are the Workspace’s raycasting functions, such as Workspace/FindPartOnRay.

Accessing the Workspace

The Workspace can be accessed several ways, all of which are valid.

workspace -- a global variable
game.Workspace -- a property of the DataModel
game:GetService("Workspace") -- workspace is a service

Notes

  • Objects that require adornment, such as ParticleEmitters and BillboardGuis will be adorned to the 0, 0, 0 position when adorned to the Workspace (parented to it without an adornee otherwise being set)
  • The Model/MakeJoints and Model/BreakJoints functions inherited from the Model class are overridden by the Workspace’s own Workspace/MakeJoints and Workspace/BreakJoints functions, which can only be used in plugins
  • It is impossible to delete the Workspace
  • The Workspace will also clean up BaseParts that fall beneath Workspace/FallenPartsDestroyHeight
  • A client’s current Camera object can be accessed using the Workspace/CurrentCamera property
  • The Terrain object can be accessed using the Workspace/Terrain property

Properties

bool

AllowThirdPartySales

[NotReplicated]

Determines whether assets created by other uses can be sold in the game.

AutoJointsMode

AutoJointsMode

[NotScriptable]
Camera

CurrentCamera

[NotReplicated]

The Camera object being used by the local player.

double

DistributedGameTime

[NotReplicated]

The amount of time, in seconds, that the game has been running.

float

FallenPartsDestroyHeight

Determines the height at which falling BasePart|BaseParts (and their ancestor Model|Models) are destroyed

bool

FilteringEnabled

Determines whether changes made from the client will replicate to the server or not.

float

Gravity

Determines the acceleration due to gravity applied to falling BaseParts.

bool

StreamingEnabled

Whether network streaming is enabled for the place

int

StreamingMinRadius

[NotScriptable]

Minimum distance that parts will be streamed to players with high priority

StreamingPauseMode

StreamingPauseMode

[NotScriptable]
int

StreamingTargetRadius

[NotScriptable]

Maximum distance that parts will be streamed to players

bool

TemporaryLegacyPhysicsSolverOverride

[NotReplicated] [NotScriptable]
Instance

Terrain

[ReadOnly] [NotReplicated]

A reference to the Terrain object parented to the Workspace

Functions

void

BreakJoints ( Objects objects )

Goes through all BaseParts given, breaking any joints connected to these parts.

bool

ExperimentalSolverIsEnabled ( )

Returns true if the game has the PGS Physics solver enabled.

Tuple

FindPartOnRay ( Ray ray , Instance ignoreDescendantsInstance , bool terrainCellsAreCubes , bool ignoreWater )

Returns the first BasePart intersecting with the given DataType/Ray.

Tuple

FindPartOnRayWithIgnoreList ( Ray ray , Objects ignoreDescendantsTable , bool terrainCellsAreCubes , bool ignoreWater )

Returns the first BasePart intersecting with the given DataType/Ray that isn’t in, or a descendant of an object in, the given ignore list

Tuple

FindPartOnRayWithWhitelist ( Ray ray , Objects whitelistDescendantsTable , bool ignoreWater )

Returns the first BasePart intersecting with the given DataType/Ray that is in, or is a descendant of an object in, the given white-list

Objects

FindPartsInRegion3 ( Region3 region , Instance ignoreDescendantsInstance , int maxParts )

Returns an array of BaseParts in the given DataType/Region3.

Objects

FindPartsInRegion3WithIgnoreList ( Region3 region , Objects ignoreDescendantsTable , int maxParts )

Returns an array of BaseParts in the given DataType/Region3 that aren’t in, or a descendant of an entry in, the given IgnoreList.

Objects

FindPartsInRegion3WithWhiteList ( Region3 region , Objects whitelistDescendantsTable , int maxParts )

Returns an array of BaseParts in the given DataType/Region3 that are in, or descendant of an object in, a given white list.

int

GetNumAwakeParts ( )

Returns the number of BaseParts that are deemed physically active, due to being recently under the influence of physics.

int

GetPhysicsThrottling ( )

Returns an integer, between 0 and 100, representing the percentage of real-time that physics simulation is currently being throttled to.

double

GetRealPhysicsFPS ( )

Returns the number of frames per second that physics is currently being simulated at.

bool

IsRegion3Empty ( Region3 region , Instance ignoreDescendentsInstance )

Returns a bool stating if no BaseParts are in the given DataType/Region3.

bool

IsRegion3EmptyWithIgnoreList ( Region3 region , Objects ignoreDescendentsTable )

Returns a bool stating if no BaseParts are in the given DataType/Region3, ignoring any BaseParts that are in, or descend from objects in, the ignore list given.

void

JoinToOutsiders ( Objects objects , JointCreationMode jointType )

Creates joints between the specified BasePart|Parts and any touching parts depending on the parts’ surfaces and the specified joint creation mode.

void

MakeJoints ( Objects objects )

Goes through all BaseParts given. If any part’s side has a Enum/SurfaceType that can make a joint it will create a joint with any adjacent parts.

bool

PGSIsEnabled ( )

Returns true if the game has the PGS Physics solver enabled.

void

SetPhysicsThrottleEnabled ( bool value )

Determines whether physics throttling is enabled

void

UnjoinFromOutsiders ( Objects objects )

Breaks all joints between the specified BaseParts and other BaseParts.

void

ZoomToExtents ( )

Positions and zooms the Workspace/CurrentCamera to show the extent of BaseParts currently in the Workspace.

Events