概要
robloxでassistantやってみた。
練習問題、やってみた。
練習問題
CollectionServiceを使え。
サンプルコード
print(game["Run Service"]:IsClient(), script:GetFullName())
local CS = game.CollectionService
CS:GetInstanceAddedSignal("test"):Connect(function(a)
print("added", a)
end)
CS:GetInstanceRemovedSignal("test"):Connect(function(a)
print("removed", a)
end)
print("a")
wait(1)
print("b")
Instance.new("Part", workspace):AddTag("test")
wait(1)
game.Workspace.Part:Destroy();
実行結果
10:11:12.027 Hello world! - サーバー
10:11:12.896 true ReplicatedFirst.LocalScript - クライアント - LocalScript:4
10:11:12.897 a - クライアント - LocalScript:12
10:11:13.375 Hello world! - クライアント
10:11:14.083 b - クライアント - LocalScript:14
10:11:14.084 added Part - クライアント - LocalScript:7
10:11:15.087 removed Part - クライアント - LocalScript:10
以上。