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.

Content

The Content data type represents a reference to asset content stored externally or as an object within the place, wrapping a single value of one of the supported ContentSourceType values.

Warning

Replication is not yet supported for Object values. When an Instance with a Content property containing a Object value is replicated, an unusable placeholder Object of the same type will be used instead of the Object itself, and any attempt to read or write the contents of that placeholder object will throw. These placeholder objects will render as a cyan and magenta checkerboard pattern.

This will be replaced with standard replication behavior in the future. For now, do not use EditableImage or EditableMesh as Content on the server on an Instance that can replicate to clients.

Constructors

NameType / ReturnsDescription
Content.fromUriReturns a new Content with an asset URI string value referencing content external to the place.
Content.fromAssetIdReturns a new Content from a numeric asset ID.
Content.fromObjectReturns a new Content with a strong reference to an Object.

Content.fromUri

Returns a new Content with an asset URI string value referencing content external to the place.

Content.SourceType will be Uri, and Content.Uri will contain a non‑nil string value.

If uri is empty, Content.none will be returned instead.

Parameters

NameTypeDefaultDescription
uristringThe asset URI string.

Content.fromAssetId

Returns a new Content from a numeric asset ID. This is a convenience constructor equivalent to calling Content.fromUri("rbxassetid://" .. tostring(assetId)).

Content.SourceType will be Uri, and Content.Uri will contain the formatted rbxassetid:// URI string.

If assetId is 0, Content.none will be returned instead.

Throws if assetId is non‑finite, for example math.huge() or 0/0.

Parameters

NameTypeDefaultDescription
assetIdnumberThe numeric asset ID.

Content.fromObject

Returns a new Content with a strong reference to an Object.

Content.SourceType will be Object, and Content.Object will contain a non‑nil Object reference.

Content.Object references are strong references that hold shared ownership of the Object. Any Content.Object reference will extend the lifetime of that Object and prevent it from being garbage collected.

Throws if object is nil.

Parameters

NameTypeDefaultDescription
objectObjectThe Object to reference.

Properties

NameType / ReturnsDescription
Content.noneContentAn empty Content value with Content.SourceType of None.
Content.SourceTypeEnum.ContentSourceTypeThe source type of the contained value.
Content.Uristring?A URI string if Content.SourceType is Uri, otherwise nil.
Content.ObjectObject?A reference to a non-nil Object if Content.SourceType is Object, otherwise nil.
Content.OpaqueOpaque?A reference to a non-nil Opaque content if Content.SourceType is Opaque, otherwise nil.

Content.none

An empty Content value with Content.SourceType of None.

FieldValue
typeContent

Content.SourceType

The source type of the contained value. Indicates which property contains a non‑nil value.

FieldValue
typeEnum.ContentSourceType

Content.Uri

A URI string if Content.SourceType is Uri, otherwise nil.

FieldValue
typestring?

Content.Object

A reference to a non-nil Object if Content.SourceType is Object, otherwise nil.

FieldValue
typeObject?

Content.Opaque

A reference to a non-nil Opaque content if Content.SourceType is Opaque, otherwise nil.

FieldValue
typeOpaque?

Constants

NameType / ReturnsDescription
Content.noneContentAn empty Content value with Content.SourceType of None.

Content.none

An empty Content value with Content.SourceType of None.

FieldValue
typeContent