AssetService

Veraltete anzeigen

*Dieser Inhalt wurde mit KI (Beta) übersetzt und kann Fehler enthalten. Um diese Seite auf Englisch zu sehen, klicke hier.

Nicht erstellbar
Dienst

AssetService ist ein nicht replizierter Dienst, der Asset-bezogene Anfragen an die Roblox-Web-API verarbeitet.

Zusammenfassung

Methoden

Eigenschaften

Methoden

CreateEditableImage

Parameter

editableImageOptions: Dictionary
Standardwert: ""

Rückgaben

CreateEditableMesh

Parameter

editableMeshOptions: Dictionary
Standardwert: ""

Rückgaben

CreateAssetAsync

Angehalten

Parameter

object: Object
Standardwert: ""
assetType: Enum.AssetType
Standardwert: ""
requestParameters: Dictionary
Standardwert: "nil"

Rückgaben

Code-Beispiele

AssetService: CreateAssetAsync

local AssetService = game:GetService("AssetService")
local editableMesh = AssetService:CreateEditableMesh()
-- füge vertices, gesichter und uvs zum netz hinzu
local requestParameters = {
CreatorId = 123,
CreatorType = Enum.AssetCreatorType.User,
Name = "My asset",
Description = "a good asset",
}
local ok, result, idOrUploadErr = pcall(function()
return AssetService:CreateAssetAsync(editableMesh, Enum.AssetType.Mesh, requestParameters)
end)
if not ok then
warn(`error calling CreateAssetAsync: {result}`)
elseif result == Enum.CreateAssetResult.Success then
print(`success, new asset id: {idOrUploadErr}`)
else
warn(`upload error in CreateAssetAsync: {result}, {idOrUploadErr}`)
end

CreateAssetVersionAsync

Angehalten

Parameter

object: Object
Standardwert: ""
assetType: Enum.AssetType
Standardwert: ""
assetId: number
Standardwert: ""
requestParameters: Dictionary
Standardwert: "nil"

Rückgaben

Code-Beispiele

AssetService: Erstellt AssetversionAsync

local AssetService = game:GetService("AssetService")
local assetIdToUpdate = 321
local model = Instance.new("Model")
local requestParameters = {
CreatorId = 123,
CreatorType = Enum.AssetCreatorType.User,
}
local ok, result, versionOrUploadErr = pcall(function()
return AssetService:CreateAssetVersionAsync(model, Enum.AssetType.Model, assetIdToUpdate, requestParameters)
end)
if not ok then
warn(`error calling CreateAssetVersionAsync: {result}`)
elseif result == Enum.CreateAssetResult.Success then
print(`success, new asset version: {versionOrUploadErr}`)
else
warn(`upload error in CreateAssetVersionAsync: {result}, {versionOrUploadErr}`)
end

CreateEditableImageAsync

Angehalten

Parameter

content: Content
Standardwert: ""
editableImageOptions: Dictionary
Standardwert: ""

Rückgaben

CreateEditableMeshAsync

Angehalten

Parameter

content: Content
Standardwert: ""
editableMeshOptions: Dictionary
Standardwert: ""

Rückgaben

CreateMeshPartAsync

Angehalten

Parameter

meshContent: Content
Standardwert: ""
options: Dictionary
Standardwert: "nil"

Rückgaben

CreatePlaceAsync

Angehalten

Parameter

placeName: string
Standardwert: ""
templatePlaceID: number
Standardwert: ""
description: string
Standardwert: ""

Rückgaben

CreatePlaceInPlayerInventoryAsync

Angehalten

Parameter

player: Instance
Standardwert: ""
placeName: string
Standardwert: ""
templatePlaceID: number
Standardwert: ""
description: string
Standardwert: ""

Rückgaben

GetAssetIdsForPackage

Angehalten

Parameter

packageAssetId: number
Standardwert: ""

Rückgaben

GetAudioMetadataAsync

Angehalten

Parameter

idList: Array
Standardwert: ""

Rückgaben

Code-Beispiele


local AssetService = game:GetService("AssetService")
local SoundService = game:GetService("SoundService")
local trackIDs = {
SoundService.Sound1.SoundId,
SoundService.Sound2.SoundId,
SoundService.Sound3.SoundId,
SoundService.Sound4.SoundId,
}
local success, result = pcall(function()
return AssetService:GetAudioMetadataAsync(trackIDs)
end)
if success then
for i = 1, #trackIDs do
local contentId = "rbxassetid://" .. result[i].AssetId
if trackIDs[i] == contentId then
print(result[i].Title, "by", result[i].Artist)
else
warn("No metadata fetched for requested asset #" .. tostring(i))
end
end
end

GetBundleDetailsAsync

Angehalten

Parameter

bundleId: number
Standardwert: ""

Rückgaben

Code-Beispiele

Getting Bundle Details

local AssetService = game:GetService("AssetService")
local BUNDLE_ID = 14
local success, result = pcall(function()
return AssetService:GetBundleDetailsAsync(BUNDLE_ID)
end)
if success then
print(result)
--[[
{
["BundleType"] = "BodyParts",
["Description"] = "The year is 5003, Battlebot 5000 must face his mightiest foe, or face becoming obsolete.",
["Id"] = 14,
["Items"] = {
[1] = {...},
[2] = {
["Id"] = 1678225030,
["Name"] = "SinisterBot 5001 Left Arm",
["Type"] = "Asset"
},
[3] = {...},
[4] = {...},
[5] = {...},
[6] = {...},
[7] = {...}
},
["Name"] = "SinisterBot 5001"
}
--]]
end

GetGamePlacesAsync

Angehalten

Rückgaben

Code-Beispiele

AssetService: Spielplätze abrufenAsync

local AssetService = game:GetService("AssetService")
local placePages = AssetService:GetGamePlacesAsync()
while true do
for _, place in placePages:GetCurrentPage() do
print("Name:", place.Name)
print("PlaceId:", place.PlaceId)
end
if placePages.IsFinished then
break
end
placePages:AdvanceToNextPageAsync()
end

PromptCreateAssetAsync

Angehalten

Parameter

player: Player
Standardwert: ""
instance: Instance
Standardwert: ""
assetType: Enum.AssetType
Standardwert: ""

Rückgaben

PromptImportAnimationClipFromVideoAsync

Angehalten

Parameter

player: Player
Standardwert: ""
progressCallback: function
Standardwert: ""

Rückgaben

SavePlaceAsync

()
Angehalten

Parameter

requestParameters: Dictionary
Standardwert: ""

Rückgaben

()

SearchAudio

Angehalten

Parameter

searchParameters: AudioSearchParams
Standardwert: ""

Rückgaben

Code-Beispiele

Getting Music Search Titles

local AssetService = game:GetService("AssetService")
local audioSearchParams = Instance.new("AudioSearchParams")
audioSearchParams.SearchKeyword = "happy"
local success, result = pcall(function()
return AssetService:SearchAudio(audioSearchParams)
end)
if success then
local currentPage = result:GetCurrentPage()
for _, audio in currentPage do
print(audio.Title)
end
else
warn("AssetService error: " .. result)
end
--[[ Returned data format
{
"AudioType": string,
"Artist": string,
"Title": string,
"Tags": {
"string"
},
"Id": number,
"IsEndorsed": boolean,
"Description": string,
"Duration": number,
"CreateTime": string,
"UpdateTime": string,
"Creator": {
"Id": number,
"Name": string,
"Type": number,
"IsVerifiedCreator": boolean
}
}
--]]

Events