Well, you do have to save that information in order to get it if you want to access it from a different place. You could then take it off [the game’s cloud, like in the example] after you successfully loaded it in. Or maybe you’d just want to get that information while in the same place that has the information, then you might want something like this:
local GameDataService = game:GetService("GameDataService") -- this is a fake service, please don't actually try to get this service (for those who's looking for the same answer)
local otherPlaceData = GameDataService:GetGameData() -- returns the current place's data with the instances properties stored as arrays, in an array.
But, to answer your question, it is possible to script. It’s just a little harder to create, in my opinion. Of course, you’d want to make a module fore this if you’re planning on using its functions more than once, but there are a few approaches to this. If you just want to get the current game’s data without getting it from another place, you don’t need to read the last two approaches.
If you just want a specific instance’s information, you can just get that instance and get its properties from there and put that information into an array. Then just
-- example:
local MyBrick = workspace:FindFirstChild("Bob The Brick")
local MyBricksDictionary = {}
MyBricksDictionary.BrickColor = MyBrick.BrickColor
MyBricksDictionary.Name = MyBrick.Name
MyBricksDictionary.Size = MyBrick.Size
MyBricksDictionary.CFrame = MyBrick.CFrame
If you want to get all the instances, it’s the same thing as getting one instance. Except, you would have to loop through the workspace’s children and store them. I say in the workspace, since in your example, it looks like you just want to get the instance that’s a descendant to the workspace.
-- example:
local WorkspaceDictionary = {}
local function InstanceToArray(instance)
local InstanceDictionary = {}
InstanceDictionary.Name = instance.Name
InstanceDictionary.ClassName = instance.ClassName
-- and you can just add other properties
-- ideally, you'd check what type of instance it is, but in this example, it doesn't
return InstanceDictionary
end
for _, instance in workspace do
WorkspaceDictionary[instance.Name] = InstanceToArray(instance)
end
print(WorkspaceDictionary)
Now, you also might not want to do the instance class checking and doing the properties, to which would be an easy way of making your script 2000+ lines long since there’s a lot of classes. But, there’s a better way of doing that. You can just use HTTPService
to get the properties of that specific instance, which you can convert the properties into an array of strings. Thankfully, someone already done that here. (You can choose to follow the tutorial, but the main code is most likely in there. They also have a version of where it doesn’t include HttpService
here)
And, with that being the case, the InstanceToArray
function would look more like this:
local GetProperties = require(module.to.property.loader)
local function InstanceToArray(instance)
local InstanceDictionary = {}
for _, property in GetProperties(instance.ClassName) do
InstanceDictionary[property] = instance[property]
end
return InstanceDictionary -- wow, only 6 lines to code!!!1!11!
end
And there you have it, a way of storing the game’s information into a table for you to use!
Now, if this is not what you were looking for and wanted a way of getting the information outside that game, then you would have to do some exploring with DataStoreService
or HttpService
. (if you want to store the information outside the game, which would be more advanced) But, I do hope this very long essay helped out!
(And if it does help, make sure to mark it as the solution ^^)