3 min read

Source: Roblox Creator Hub · CC BY 4.0 · View source · Code samples: MIT Imported 2026-10-03. Formatting adapted for this site.

SecurityCapabilities

An immutable set of SecurityCapability values that controls which engine APIs and actions a script inside a sandboxed container can access. Assign a SecurityCapabilities value to an instance's Capabilities property to restrict the scripts beneath it.

Capability enforcement takes effect when Workspace.SandboxedInstanceMode is set to SandboxedInstanceMode.Experimental.

Constructors

NameType / ReturnsDescription
SecurityCapabilities.newReturns a new set of capabilities from zero or more SecurityCapability items.
SecurityCapabilities.fromCurrentReturns a new set of capabilities from the capabilities of the calling function.

SecurityCapabilities.new

Returns a new set of capabilities from zero or more SecurityCapability items.

local capabilities = SecurityCapabilities.new(Enum.SecurityCapability.Players,
    Enum.SecurityCapability.Animation,
    Enum.SecurityCapability.Basic)

local newScript = Instance.new("Script")
newScript.Capabilities = capabilities

Parameters

NameTypeDefaultDescription
...SecurityCapabilityZero or more SecurityCapability values to include in the new set.

SecurityCapabilities.fromCurrent

Returns a new set of capabilities from the capabilities of the calling function.

Methods

NameType / ReturnsDescription
SecurityCapabilities:AddSecurityCapabilitiesReturns a new set of capabilities with zero or more additions.
SecurityCapabilities:AddSecurityCapabilitiesReturns a new set of capabilities with the provided set added.
SecurityCapabilities:RemoveSecurityCapabilitiesReturns a new set of capabilities with zero or more deletions.
SecurityCapabilities:RemoveSecurityCapabilitiesReturns a new set of capabilities with the provided set deleted.
SecurityCapabilities:ContainsbooleanReturns whether a set of capabilities contains the specified SecurityCapability items.
SecurityCapabilities:ContainsbooleanReturns whether a set of capabilities contains another set of capabilities.

SecurityCapabilities:Add

Returns a new set of capabilities with zero or more additions. If you add SecurityCapability items that are already present, they are not duplicated.

Parameters

NameTypeDefaultDescription
...SecurityCapabilityZero or more SecurityCapability values to add to the set.

Returns

TypeDescription
SecurityCapabilitiesA new set containing the union of the original capabilities and the specified additions.

SecurityCapabilities:Add

Returns a new set of capabilities with the provided set added. If you add SecurityCapability items that are already present, they are not duplicated.

Parameters

NameTypeDefaultDescription
capabilitiesSecurityCapabilitiesA SecurityCapabilities set whose items are added to the original.

Returns

TypeDescription
SecurityCapabilitiesA new set containing the union of both sets.

SecurityCapabilities:Remove

Returns a new set of capabilities with zero or more deletions. SecurityCapability items not present in the original set are ignored.

Parameters

NameTypeDefaultDescription
...SecurityCapabilityZero or more SecurityCapability values to remove from the set.

Returns

TypeDescription
SecurityCapabilitiesA new set with the specified capabilities removed.

SecurityCapabilities:Remove

Returns a new set of capabilities with the provided set deleted. SecurityCapability items not present in the original set are ignored.

Parameters

NameTypeDefaultDescription
capabilitiesSecurityCapabilitiesA SecurityCapabilities set whose items are removed from the original.

Returns

TypeDescription
SecurityCapabilities

SecurityCapabilities:Contains

Returns whether a set of capabilities contains the specified SecurityCapability items. The set must contain all provided items to return true.

Parameters

NameTypeDefaultDescription
...SecurityCapabilityZero or more SecurityCapability values to check for membership in the set.

Returns

TypeDescription
boolean

SecurityCapabilities:Contains

Returns whether a set of capabilities contains another set of capabilities. The set must contain all items in the provided set to return true.

Parameters

NameTypeDefaultDescription
capabilitiesSecurityCapabilitiesA SecurityCapabilities set to check for membership in the original set.

Returns

TypeDescription
boolean