GetCollection (Function): Difference between revisions
From Goodblox Wiki
Jump to navigationJump to search
(created the page) |
No edit summary |
||
| Line 7: | Line 7: | ||
|object = [[GBX.lua.CollectionService (Service)|CollectionService]] | |object = [[GBX.lua.CollectionService (Service)|CollectionService]] | ||
}}</onlyinclude> | }}</onlyinclude> | ||
==Example== | |||
<pre> | |||
local CollectionService = game:GetService("CollectionService") | |||
for i = 1, 10 do | |||
Instance.new("Configuration", workspace) | |||
end | |||
local objects = CollectionService:GetCollection("Configuration") | |||
print(#objects) | |||
</pre> | |||
[[Category:Functions]] | [[Category:Functions]] | ||
Latest revision as of 02:58, 25 September 2021
| Function | |
|---|---|
| Syntax | GetCollection( String class ) |
| Returns | Objects |
| Description: | This function returns all instances of a given class which are in the DataModel. Only works for Configuration and VehicleSeat. |
| In Object: | CollectionService |
Example
local CollectionService = game:GetService("CollectionService")
for i = 1, 10 do
Instance.new("Configuration", workspace)
end
local objects = CollectionService:GetCollection("Configuration")
print(#objects)