0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

robloxでassistant その151

Posted at

概要

robloxでassistantやってみた。
練習問題、やってみた。

練習問題

ContentProviderを使え。

サンプルコード

local ContentProvider = game:GetService("ContentProvider")
local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://9120386436"
local decal = Instance.new("Decal")
decal.Texture = "rbxassetid://5447528495"
local assets = {
	decal,
	sound,
}
local callback = function(assetId, assetFetchStatus)
  	print("PreloadAsync() resolved asset ID:", assetId)
  	print("PreloadAsync() final AssetFetchStatus:", assetFetchStatus)
end
local startTime = os.clock()
ContentProvider:PreloadAsync(assets, callback)
local deltaTime = os.clock() - startTime
print(("Preloading complete, took %.2f seconds"):format(deltaTime))


実行結果

  11:29:03.693  Hello world!  -  サーバー
  11:29:05.331  PreloadAsync() resolved asset ID: rbxassetid://9120386436  -  クライアント - LocalScript:13
  11:29:05.331  PreloadAsync() final AssetFetchStatus: Enum.AssetFetchStatus.Success  -  クライアント - LocalScript:14
  11:29:05.937  Hello world!  -  クライアント
  11:29:06.819  PreloadAsync() resolved asset ID: rbxassetid://5447528495  -  クライアント - LocalScript:13
  11:29:06.819  PreloadAsync() final AssetFetchStatus: Enum.AssetFetchStatus.Success  -  クライアント - LocalScript:14
  11:29:07.322  Preloading complete, took 2.46 seconds  -  クライアント - LocalScript:19

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?