forked from Roblox/creator-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssetService.yaml
More file actions
973 lines (921 loc) · 33.1 KB
/
AssetService.yaml
File metadata and controls
973 lines (921 loc) · 33.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
# This file is automatically generated. Please don't edit it manually.
# To submit a bug report on the content, see
# https://devforum.roblox.com/c/bug-reports/documentation-issues/72
name: AssetService
type: class
memory_category: Instances
summary: |
A non-replicated service that handles asset-related queries to the Roblox web
API.
description: |
**AssetService** is a non-replicated service that handles asset-related
queries to the Roblox web API.
code_samples: []
inherits:
- Instance
descendants: []
tags:
- NotCreatable
- Service
deprecation_message: ''
properties:
- name: AssetService.AllowInsertFreeAssets
summary: |
Controls whether `Class.AssetService:LoadAssetAsync()` can load assets
that are not owned by the experience creator.
description: |
This property can only be modified in Studio's **Experience Settings** by
changing **Allow Loading Third Party Assets**.
When `false` (default), `Class.AssetService:LoadAssetAsync()` can only
load assets that meet one of the following:
- The asset must be **created or owned** by the game creator.
- The asset must be **shared** by the asset owner.
- The asset must be owned by Roblox.
When `true`, `Class.AssetService:LoadAssetAsync()` can additionally load
any public free asset on the Creator Store.
code_samples: []
type: boolean
tags: []
deprecation_message: ''
security:
read: RobloxScriptSecurity
write: RobloxScriptSecurity
thread_safety: ReadSafe
category: Behavior
serialization:
can_load: true
can_save: true
capabilities: []
methods:
- name: AssetService:ComposeDecalAsync
summary: |
Modifies an existing `Class.Decal` to contain a composite PBR textures
created by layering the provided textures in the order they are provided
in the `layers` array. Textures layer based on the alpha value of the
color map.
description: |
Modifies an existing `Class.Decal` to contain a composed texture derived
from one or more layered texture sets. Each set can include color,
roughness, metalness, and normal maps. Each layer in `layers` is
composited in the order they are provided, with the color map alpha
channel used to determine blending.
- There is a limit of 8 layers.
- Layering order is bottom-to-top: the first layer in the list provides
the bottom-most textures.
- Each dictionary table should contain the following key-value pairs:
- **ColorMap**: A `Datatype.Content` referencing a color (albedo)
texture by assetId.
- **RoughnessMap**: A `Datatype.Content` referencing a roughness texture
by assetId.
- **MetalnessMap**: A `Datatype.Content` referencing a metalness texture
by assetId.
- **NormalMap**: A `Datatype.Content` referencing a normal texture by
assetId.
- `ColorMap` is mandatory in every layer. The ColorMap's alpha channel is
used to control blending of the entire layer.
- `NormalMap`, `MetalnessMap`, `RoughnessMap` are optional. If omitted,
this layer doesn't perform any blending for those maps.
code_samples:
- AssetService-ComposeDecalAsync
parameters:
- name: decal
type: Decal
default:
summary: |
A `Class.Decal` instance that will be modified to contain a
representation of the layers. Any existing maps on this instance will
be cleared.
- name: layers
type: Array
default:
summary: |
An array of dictionary tables that maps PBR names to
`Datatype.Content` IDs.
returns:
- type: ()
summary: ''
tags:
- Yields
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities: []
- name: AssetService:CreateAssetAsync
summary: |
Uploads a new asset to Roblox from the given object.
description: |
Uploads a new asset to Roblox from the given object.
Currently, this method can only be used in locally loaded plugins and
uploads assets without prompting first.
code_samples:
- AssetService-CreateAssetAsync
parameters:
- name: object
type: Object
default:
summary: |
The object to be created as an asset.
- name: assetType
type: AssetType
default:
summary: |
Currently supported types are:
- `Enum.AssetType.Model` – with `object` as any valid `Class.Instance`
root.
- `Enum.AssetType.Plugin` – with `object` as any valid
`Class.Instance` root.
- `Enum.AssetType.Mesh` – with `object` as any valid
`Class.EditableMesh` root.
- `Enum.AssetType.Image` – with `object` as any valid
`Class.EditableImage` root.
- name: requestParameters
type: Dictionary
default: nil
summary: |
Options table containing asset metadata:
- `Name` – Name of the asset as a string. Defaults to `[object.Name]`.
- `Description` – Description of the asset as a string. Defaults to
`"Created with AssetService:CreateAssetAsync"`.
- `CreatorId` – ID of the asset creator as a number. Defaults to the
logged in Roblox Studio user for Plugin context. Required for Open
Cloud Luau Execution context.
- `CreatorType` – `Enum.AssetCreatorType` indicating the type of asset
creator. Defaults to `Enum.AssetCreatorType.User` in Plugin context.
Required for Open Cloud Luau Execution context.
- `IsPackage` – Boolean value, only applicable to the
`Enum.AssetType.Model` type. Defaults to `true`.
returns:
- type: Tuple
summary: |
The `Enum.CreateAssetResult` and asset ID pair if successful.
tags:
- Yields
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- AssetCreateUpdate
- name: AssetService:CreateAssetVersionAsync
summary: |
Uploads a new version for an existing asset from the given object.
description: |
Uploads a new version for an existing asset from the given object.
Currently, this method can only be used in locally loaded plugins and
uploads assets without prompting first.
code_samples:
- AssetService-CreateAssetVersionAsync
parameters:
- name: object
type: Object
default:
summary: |
The object to be created as an asset.
- name: assetType
type: AssetType
default:
summary: |
Currently supported types are:
- `Enum.AssetType.Model` – with `object` as any valid `Class.Instance`
root.
- `Enum.AssetType.Plugin` – with `object` as any valid
`Class.Instance` root.
- `Enum.AssetType.Mesh` – with `object` as any valid
`Class.EditableMesh` root.
- `Enum.AssetType.Image` – with `object` as any valid
`Class.EditableImage` root.
- name: assetId
type: int64
default:
summary: |
The ID of the asset for the new version.
- name: requestParameters
type: Dictionary
default: nil
summary: |
Options table containing asset metadata:
- `Name` – A `string`. Name of the asset. Default: object.Name.
- `Description` – A `string`. Description of the asset. Default:
"Created with AssetService:CreateAssetAsync".
- `CreatorId` – A `number`. ID of the asset creator. Default: The
logged in Roblox Studio user for Plugin context. Required for Open
Cloud Luau Execution context.
- `CreatorType` – A `Enum.AssetCreatorType`. Type of asset creator.
Default: `Enum.AssetCreatorType.User` in Plugin context. Required
for Open Cloud Luau Execution context.
- `IsPackage` – A `bool`. Only applicable to the
`Enum.AssetType.Model` type. Default: true.
returns:
- type: Tuple
summary: |
The `Enum.CreateAssetResult` and asset version number pair if
successful.
tags:
- Yields
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- AssetCreateUpdate
- name: AssetService:CreateEditableImage
summary: |
Creates a new `Class.EditableImage`.
description: |
Creates a new `Class.EditableImage`. By default, the resolution is set at
512×512, but you can specify a different size using the method's
option table.
If the device‑specific editable memory budget is exhausted, creation fails
and this method returns `nil`.
code_samples: []
parameters:
- name: editableImageOptions
type: Dictionary?
default:
summary: |
Options table containing controls for the method:
- `Size` – A `Datatype.Vector2` that specifies the image's desired
width and height.
returns:
- type: EditableImage
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- DynamicGeneration
- name: AssetService:CreateEditableImageAsync
summary: |
Creates a new `Class.EditableImage` object populated with the given image.
description: |
Creates a new `Class.EditableImage` object populated with the given
texture. Non-asset texture IDs such as `rbxthumb://` are supported. If
using an image asset, it must be associated with and/or owned by a creator
of the experience, or it must have been created inside the experience. If
the device-specific editable memory budget is exhausted, creation will
fail and this method will return `nil`.
See the `Class.EditableImage` documentation for special considerations
when using this API.
code_samples: []
parameters:
- name: content
type: Content
default:
summary: |
Reference to asset content stored externally or as an object within
the place, wrapping a single value of one of the supported
`Enum.ContentSourceType` values.
- name: editableImageOptions
type: Dictionary?
default:
summary: |
Table containing options for the created `Class.EditableImage`.
Currently no options are available since resizing via
`Class.EditableImage.Size|Size` is not supported.
returns:
- type: EditableImage
summary: |
A new `Class.EditableImage` containing the provided image.
tags:
- Yields
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- AssetRead
- name: AssetService:CreateEditableMesh
summary: |
Creates a new, empty `Class.EditableMesh`.
description: |
Creates a new, empty `Class.EditableMesh`. Vertices, triangles, and their
attributes can be added dynamically to it. If the device‑specific editable
memory budget is exhausted, creation will fail and this method will return
`nil`.
code_samples: []
parameters:
- name: editableMeshOptions
type: Dictionary?
default:
summary: |
Table containing options for the created `Class.EditableMesh`.
Currently no options are available since
`Class.EditableMesh.FixedSize|FixedSize` will always be `false` for
empty editable meshes.
returns:
- type: EditableMesh
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- DynamicGeneration
- name: AssetService:CreateEditableMeshAsync
summary: |
Returns a new `Class.EditableMesh` object created from an existing mesh
content ID.
description: |
Returns a new `Class.EditableMesh` object created from an existing
`Class.EditableMesh` or mesh `Datatype.Content` ID. By default, an
`Class.EditableMesh` created from this method will be fixed size such that
mesh data can only be modified, not added nor removed. A fixed size
`Class.EditableMesh` consumes less memory and should be preferred when
possible.
If the device-specific editable memory budget is exhausted, creation will
fail and this method will return `nil`.
See the **Enabling for Published Experiences** and **Permissions**
sections of `Class.EditableMesh` for special considerations when using
this API.
code_samples: []
parameters:
- name: content
type: Content
default:
summary: |
Reference to asset content stored externally or as an object within
the place, wrapping a single value of one of the supported
`Enum.ContentSourceType` values.
- name: editableMeshOptions
type: Dictionary?
default:
summary: |
Options table containing controls for the method:
- `FixedSize` – A `bool`. Default value is `true`, and the returned
`Class.EditableMesh` will not allow you to add or remove vertices,
only modify their values. Set to `false` if the ability to change
the mesh topology is required, at the expense of using more memory.
returns:
- type: EditableMesh
summary: |
The new `Class.EditableMesh` instance.
tags:
- Yields
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- AssetRead
- name: AssetService:CreateMeshPartAsync
summary: |
Creates a new `Class.MeshPart` with a specified mesh ID and an optional
table of fidelity values.
description: |
This method creates a `Class.MeshPart` with a specified
`Class.MeshPart.CollisionFidelity|CollisionFidelity`,
`Class.MeshPart.RenderFidelity|RenderFidelity`, and
`Class.MeshPart.FluidFidelity|FluidFidelity`. Because
`Class.MeshPart.MeshId` is read only, this method is for creating a mesh
with any mesh ID through scripts, without having to clone an existing
`Class.MeshPart`. It throws errors if creation fails.
code_samples: []
parameters:
- name: meshContent
type: Content
default:
summary: |
Reference to asset content stored externally or as an object within
the place, wrapping a single value of one of the supported
`Enum.ContentSourceType` values.
- name: options
type: Dictionary
default: nil
summary: |
Options table containing one or more controls for the method:
- `CollisionFidelity` – The value of
`Class.MeshPart.CollisionFidelity|CollisionFidelity` in the
resulting part. Defaults to `Enum.CollisionFidelity.Default` if the
option is absent or the `options` table is `nil`.
- `RenderFidelity` – The value of
`Class.MeshPart.RenderFidelity|RenderFidelity` in the resulting
part. Defaults to `Enum.RenderFidelity.Automatic` if the option is
absent or the `options` table is `nil`.
- `FluidFidelity` – The value of
`Class.MeshPart.FluidFidelity|FluidFidelity` in the resulting part.
Defaults to `Enum.FluidFidelity.Automatic` if the option is absent
or the `options` table is `nil`.
returns:
- type: MeshPart
summary: ''
tags:
- Yields
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- Basic
- name: AssetService:CreatePlaceAsync
summary: |
Clones a place through the given `templatePlaceID`.
description: |
Clones a place through the given `templatePlaceID` and returns the
`Class.DataModel.PlaceId|PlaceId` of the new place, which you can use with
`Class.TeleportService`. The clone place displays within the inventory of
the place's creator with the given name and description.
Note that the template place must have template copying enabled through
place settings. You cannot use this method to clone places that you don't
own.
Frequent use of this API is not recommended, particularly if the created
places contain scripts, as updating the code in a large volume of places
quickly becomes infeasible. For user-generated worlds, consider
serializing user creations and saving them in `Class.DataStore|DataStores`
instead.
code_samples: []
parameters:
- name: placeName
type: string
default:
summary: |
Name of the new place.
- name: templatePlaceID
type: int64
default:
summary: |
`Class.DataModel.PlaceId|PlaceId` of the place to clone.
- name: description
type: string
default:
summary: |
Description of the new place.
returns:
- type: int64
summary: |
`Class.DataModel.PlaceId|PlaceId` of the new place.
tags:
- Yields
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- AssetCreateUpdate
- name: AssetService:CreatePlaceInPlayerInventoryAsync
summary: |
Clones a place through the given `templatePlaceID` and puts it into the
inventory of the given player.
description: ''
code_samples: []
parameters:
- name: player
type: Instance
default:
summary: ''
- name: placeName
type: string
default:
summary: ''
- name: templatePlaceID
type: int64
default:
summary: ''
- name: description
type: string
default:
summary: ''
returns:
- type: int64
summary: ''
tags:
- Yields
deprecation_message: |
This method has been removed and is no longer functional.
security: None
thread_safety: Unsafe
capabilities:
- AssetCreateUpdate
- name: AssetService:CreateSurfaceAppearanceAsync
summary: |
Creates a new `Class.SurfaceAppearance` object using the provided content
maps.
description: |
Creates a new `Class.SurfaceAppearance` object using the provided content
maps.
Currently, content only supports `Class.EditableImage` and only content
maps can be specified, but functionality will expand to include asset IDs
as input. If you need to achieve this today, you can create an
`Class.EditableImage` from an asset ID using the following:
`Class.AssetService:CreateEditableImageAsync(Content.fromUri(uri))`
Default values will be used for all other `Class.SurfaceAppearance`
properties.
code_samples:
- AssetService-CreateSurfaceAppearanceAsync
parameters:
- name: content
type: Dictionary
default:
summary: |
Dictionary containing the following key-value pairs:
- `ColorMap` — A `Datatype.Content` object that contains the color
map. Default is `nil`.
- `MetalnessMap` — A `Datatype.Content` object that contains the
metalness map. If more than one channel is present, only the red
channel is used. Default is `nil`.
- `NormalMap` — A `Datatype.Content` object that contains the normal
map. Default is `nil`.
- `RoughnessMap` — A `Datatype.Content` object that contains the
roughness map. If more than one channel is present, only the red
channel is used. Default is `nil`.
- `EmissiveMask` — A `Datatype.Content` object that contains the
emissive mask. If more than one channel is present, only the red
channel is used. Default is `nil`.
returns:
- type: SurfaceAppearance
summary: |
A new `Class.SurfaceAppearance` instance with the given maps from the
`content` parameter.
tags:
- Yields
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- Basic
- name: AssetService:GetAssetIdsForPackageAsync
summary: |
Returns an array of asset IDs that are contained in a specified package.
description: |
Returns an array of asset IDs that are contained in a specified package.
code_samples: []
parameters:
- name: packageAssetId
type: int64
default:
summary: ''
returns:
- type: Array
summary: |
Asset IDs that are contained in a specified package.
tags:
- Yields
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- AssetRead
- name: AssetService:GetAssetIdsForPackage
summary: |
Returns an array of asset IDs that are contained in a specified package.
description: ''
code_samples: []
parameters:
- name: packageAssetId
type: int64
default:
summary: ''
returns:
- type: Array
summary: |
Asset IDs that are contained in a specified package.
tags:
- Yields
- Deprecated
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- AssetRead
- name: AssetService:GetAudioMetadataAsync
summary: |
Provides relevant metadata about a specific audio source.
description: |
Provides relevant metadata about a specific audio source (artist, title,
duration, type, etc.).
code_samples:
- AssetService-GetAudioMetadataAsync
parameters:
- name: idList
type: Array
default:
summary: |
Array of asset or content IDs for which to retrieve metadata. Max
batch size is 30.
returns:
- type: Array
summary: |
Array of dictionary tables in the same order as the request, where
each dictionary contains the following metadata for its asset/content:
- `AssetId` (string)
- `Title` (string)
- `Artist` (string)
- `Duration` (number) in seconds
- `AudioType` (`Enum.AudioSubType`)
Note that if an error occurs on fetching metadata for any of the
requested assets, for example the asset ID doesn't exist, its
dictionary table is still included in the returned array but it only
contains the `AssetId` field for reference purposes. Additionally, if
the `AudioType` cannot be determined for a given asset (perhaps
because it's private audio), the resulting dictionary will not contain
an `AudioType` entry.
tags:
- Yields
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- AssetRead
- name: AssetService:GetBundleDetailsAsync
summary: |
Returns details of the contents of specified bundle.
description: |
This function returns details of the contents of the specified bundle.
If the bundle ID does not exist, it throws `HTTP 400 (Bad Request)`. If
`bundleId` is not convertible to an integer, it throws
`Unable to cast string to int64`.
code_samples:
- getting-bundle-details
parameters:
- name: bundleId
type: int64
default:
summary: |
The ID of the specified bundle.
returns:
- type: Dictionary
summary: |
Dictionary with the following key-value pairs containing details about
the specified bundle:
- `Id` — Bundle ID (same as passed `bundleId` argument)
- `Name` — Bundle name
- `Description` — Bundle description
- `BundleType` — String representing the `Enum.BundleType`, for
example `"BodyParts"` or `"DynamicHead"`
- `Items` — Array of items in the bundle, each with details
represented through the following keys:
- `Id` — Item ID
- `Name` — Item name
- `Type` — Item type such as `"Asset"` .
tags:
- Yields
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- AssetRead
- name: AssetService:GetCreatorAssetID
summary: |
Returns the UserId of the account who created the creationID asset.
description: |
The GetCreatorAssetID function returns the `Class.Player.UserId` of the
account who created the _creationID_ asset.
This member is broken and doesn't function correctly. Avoid using it.
code_samples: []
parameters:
- name: creationID
type: int64
default:
summary: ''
returns:
- type: int64
summary: ''
tags:
- Yields
- Deprecated
deprecation_message: |
This item is deprecated and no longer functions correctly. Do not use it
for new work.
security: None
thread_safety: Unsafe
capabilities: []
- name: AssetService:GetGamePlacesAsync
summary: |
Returns a `Class.StandardPages` object which contains the name and
`Class.DataModel.PlaceId|PlaceId` of places within the current experience.
description: |
Returns a `Class.StandardPages` object which contains the name and
`Class.DataModel.PlaceId|PlaceId` of places within the current experience.
code_samples:
- AssetService-GetGamePlacesAsync1
parameters: []
returns:
- type: Instance
summary: ''
tags:
- Yields
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- AssetRead
- name: AssetService:LoadAssetAsync
summary: |
Loads a `Class.Model` instance given its asset ID. This is the modern
replacement for `Class.InsertService:LoadAsset()` and supports loading
third-party assets.
description: |
Loads the latest version of an asset from the given `assetId` and returns
it wrapped in a `Class.Model`. This method is the modern replacement for
`Class.InsertService:LoadAsset()` and
`Class.InsertService:LoadAssetVersion()` methods.
Calls to this function may fail if the asset does not exist, or if the
server providing the model is having problems. It is recommended to wrap
calls to this function in `pcall()` to handle potential errors.
```lua
local AssetService = game:GetService("AssetService")
local assetId = 257489726
local success, model = pcall(AssetService.LoadAssetAsync, AssetService, assetId)
if success and model then
print("Model loaded successfully")
model.Parent = workspace
else
warn("Model failed to load:", model) -- 'model' will contain the error message
end
```
#### Script Sandbox Security
For enhanced security, the returned `Class.Model` is sandboxed by default
(`Class.Instance.Sandboxed|Sandboxed` is `true`) and has no script
`Enum.SecurityCapability|Capabilities`. This prevents untrusted scripts
descending from the returned Model from running. To enable scripts in a
model you trust, you can manually grant a safe set of
`Enum.SecurityCapability|Capabilities` on the Model after loading.
#### Third-Party Asset Loading
Unlike `Class.InsertService:LoadAsset()`, this method can load public
assets created by **third parties** (assets not owned by the experience
creator). To enable this functionality, toggle on **Allow Loading Third
Party Assets** in Studio's **Experience Settings**.
If this setting is disabled (which it is by default), `LoadAssetAsync`
will only load assets that are owned by the experience creator, behaving
identically to the old `Class.InsertService:LoadAsset()` security check.
code_samples: []
parameters:
- name: assetId
type: int64
default:
summary: |
The asset ID number of the asset being loaded.
returns:
- type: Instance
summary: |
A `Class.Model` instance containing the loaded asset.
tags:
- Yields
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- LoadUnownedAsset
- name: AssetService:PromptCreateAssetAsync
summary: |
Allows in-experience asset creation for users by prompting a publish
dialog.
description: |
Allows in-experience asset creation for users by prompting a publish
dialog. When called, it presents a dialog to the user, allowing them to
enter a name, description, and preview the asset. Upon submitting, it
saves the asset to the user's inventory. Can only be invoked on the server
side.
code_samples: []
parameters:
- name: player
type: Player
default:
summary: |
The user who submits an asset creation.
- name: instance
type: Instance
default:
summary: |
The asset to be created. Currently can't contain scripts or nest
non-public assets.
- name: assetType
type: AssetType
default:
summary: |
The asset type. Currently can only be `Enum.AssetType.Model`.
returns:
- type: Tuple
summary: |
The `Enum.PromptCreateAssetResult` and asset ID pair if successful.
tags:
- Yields
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- AssetCreateUpdate
- name: AssetService:PromptImportAnimationClipFromVideoAsync
summary: ''
description: ''
code_samples: []
parameters:
- name: player
type: Player
default:
summary: ''
- name: progressCallback
type: Function
default:
summary: ''
returns:
- type: Tuple
summary: ''
tags:
- Yields
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- AssetManagement
- name: AssetService:SavePlaceAsync
summary: |
Saves the state of the current place.
description: |
Saves the current state of the place. Keep in mind the following
guidelines and restrictions:
- This method only works for places that are created with
`Class.AssetService:CreatePlaceAsync()` or that have the API enabled
through the place's settings.
- This method overwrites the previous state of the place. To revert a
save, publish an older version of the place.
- There are cases when saves can occur simultaneously in Studio and in
multiple experience servers. The order of the saves happen in the order
they are called.
- An active Team Create session in Studio blocks all saves from occurring.
code_samples: []
parameters:
- name: requestParameters
type: Dictionary?
default:
summary: |
Optional dictionary that includes `SaveWithoutPublish`, a boolean
indicating whether to save with publish or without publish, and
`PlaceId`, the destination place ID to save over. An example usage
would be: AssetService:SavePlaceAsync({PlaceId = 1, SaveWithoutPublish
= true}). If PlaceId is not provided, the default behavior will save
over the current original place which is calling SavePlaceAsync. If
SaveWithoutPublish is not provided, the default behavior is
SaveWithoutPublish=false.
returns:
- type: ()
summary: ''
tags:
- Yields
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- AssetCreateUpdate
- name: AssetService:SearchAudioAsync
summary: |
Finds audio assets matching a variety of search criteria.
description: |
Returns a `Class.AudioPages` object containing the result of the given
search. Will not return fields with empty values.
Note that this method has a low HTTP request limit and can throw an error,
so it should always be wrapped in `pcall()` for error handling. Possible
error messages include:
<table>
<thead>
<tr>
<th>Error Message</th>
<th>Reason</th>
</tr>
</thead>
<tbody>
<tr>
<td>HTTP 429 (Too Many Requests)</td>
<td><code>Class.AssetService:SearchAudio()</code> has been called too many times.</td>
</tr>
<tr>
<td>Unexpected type for data, expected array got null</td>
<td>The keyword argument was filtered.</td>
</tr>
</tbody>
</table>
code_samples:
- printing-search-audio-result-titles
parameters:
- name: searchParameters
type: AudioSearchParams
default:
summary: ''
returns:
- type: AudioPages
summary: ''
tags:
- Yields
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- AssetRead
- name: AssetService:SearchAudio
summary: |
Finds audio assets matching a variety of search criteria.
description: ''
code_samples:
- printing-search-audio-result-titles
parameters:
- name: searchParameters
type: AudioSearchParams
default:
summary: ''
returns:
- type: AudioPages
summary: ''
tags:
- Yields
- Deprecated
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- AssetRead
events: []
callbacks: []