Actor
*此內容是使用 AI(Beta 測試版)翻譯,可能含有錯誤。若要以英文檢視此頁面,請按一下這裡。
概要
方法
BindToMessage(topic: string,function: function):RBXScriptConnection |
BindToMessageParallel(topic: string,function: function):RBXScriptConnection |
SendMessage(topic: string,message: Tuple):() |
API 參考
方法
Bind To Message
範例程式碼
綁定到訊息
local actor = script:GetActor()
-- 當發送問候消息給 Actor 時,打印出一條消息
-- 此腳本是其子代。
actor:BindToMessage("Greeting", function(message)
print("收到問候消息:", message)
end)Bind To Message Parallel
範例程式碼
綁定到消息平行
local actor = script:GetActor()
-- 當發送問候消息到 Actor 時,打印出一條消息
-- 此腳本是其子代。
actor:BindToMessageParallel("Greeting", function(message)
print("收到問候消息:", message)
end)