Reference API Roblox

Engine API

Website

Related

Reference API Roblox

Actor

An Actor is a container for code that can be safely split into its own thread.

Member index 3

HistoryMember
570BindToMessage(topic: string, function: Function): RBXScriptConnection
570BindToMessageParallel(topic: string, function: Function): RBXScriptConnection
573SendMessage(topic: string, message: Tuple): null
inherited from Model
553LevelOfDetail: ModelLevelOfDetail
553ModelStreamingMode: ModelStreamingMode
553PrimaryPart: BasePart
562Scale: float
553WorldPivot: CFrame
573AddPersistentPlayer(playerInstance: Player = Player): null
573BreakJoints(): null
607GetBoundingBox(): (CFrame, Vector3)
462GetExtentsSize(): Vector3
553GetModelCFrame(): CFrame
553GetModelSize(): Vector3
576GetPersistentPlayers(): Objects
576GetPrimaryPartCFrame(): CFrame
562GetScale(): float
573MakeJoints(): null
573MoveTo(position: Vector3): null
573RemovePersistentPlayer(playerInstance: Player = Player): null
573ResetOrientationToIdentity(): null
573ScaleTo(newScaleFactor: float): null
573SetIdentityOrientation(): null
573SetPrimaryPartCFrame(cframe: CFrame): null
573TranslateBy(delta: Vector3): null
573breakJoints(): null
573makeJoints(): null
573move(location: Vector3): null
573moveTo(location: Vector3): null
inherited from PVInstance
553Origin: CFrame
553Pivot Offset: CFrame
576GetPivot(): CFrame
573PivotTo(targetCFrame: CFrame): null
inherited from Instance
553Archivable: bool
635Capabilities: SecurityCapabilities
553ClassName: string
553Name: string
553Parent: Instance
635Sandboxed: bool
616UniqueId: UniqueId
553className: string
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
486GetChildren(): Objects
462GetDebugId(scopeLength: int = 4): string
486GetDescendants(): Array
486GetFullName(): string
462GetPropertyChangedSignal(property: string): RBXScriptSignal
641GetStyled(name: string): Variant
576GetTags(): Array
576HasTag(tag: string): bool
486IsA(className: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
580IsPropertyModified(name: string): bool
573Remove(): null
576RemoveTag(tag: string): null
580ResetPropertyToDefault(name: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
553children(): Objects
553clone(): Instance
573destroy(): null
553findFirstChild(name: string, recursive: bool = false): Instance
553getChildren(): Objects
462isA(className: string): bool
553isDescendantOf(ancestor: Instance): bool
573remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462Changed(property: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
553childAdded(child: Instance)

Description

An Actor is a container for code that can be safely split into its own thread using task.desynchronize(). It should also contain the instances used by its scripts.

To learn more about using multiple Actors to optimize script performance, see Parallel Luau.

History 8

Members 3

BindToMessage

Parameters (2)
topicstring
functionFunction
Returns (1)
RBXScriptConnection

This method is used to bind a Luau callback to a message with the specified topic. When a message is sent (using SendMessage()) to the topic specified the provided callback will be called in a serial execution context.

Multiple Luau callbacks may be bound to a single actor and even to a single message topic.

Note: Only the scripts which are descendants of an Actor may bind to its messages.

1
2
3
4
5
6
7
local actor = script:GetActor()

-- Print out a message when a greeting message is sent to the Actor
-- this script is a descendant of.
local connection = actor:BindToMessage("Greeting", function(message)
  print("Received Greeting Message:", message)
end)

History 2

BindToMessageParallel

Parameters (2)
topicstring
functionFunction
Returns (1)
RBXScriptConnection

This method is used to bind a Luau callback to a message with the specified topic. When a message is sent (using SendMessage()) to the topic specified the provided callback will be called in a parallel execution context.

Multiple Luau callbacks may be bound to a single actor and even to a single message topic.

Note: Only the scripts which are descendants of an Actor may bind to its messages.

1
2
3
4
5
6
7
local actor = script:GetActor()

-- Print out a message when a greeting message is sent to the Actor
-- this script is a descendant of.
local connection = actor:BindToMessageParallel("Greeting", function(message)
  print("Received Greeting Message:", message)
end)

History 2

SendMessage

Parameters (2)
topicstring
messageTuple
Returns (1)
null

Sends a message to an Actor. Messages are sent asynchronously, so the sender will not block or yield when calling the SendMessage() method.

Since a single Actor may receive different kinds of messages, a topic parameter is used to distinguish between various kinds of messages.

See BindToMessage() for details on receiving a message sent using SendMessage().

1
2
-- Assume `actor` is a local variable referring to an Actor instance
actor:SendMessage("Greeting", "Hello World")

History 3

Settings