I currently have the following code:
local newBlock = block:Clone()
newBlock.Parent = workspace.Blocks
newBlock.Position = position
newBlock.Color = color
local data = {
["Color"] = tostring(color),
["Placer"] = player.UserId,
["TimeStamp"] = os.time()
}
local key = tostring(position)
-- encode just for now just does JSONEncode
local sdata, skey = encode(data, key)
How am I able to save data in a way where I can access every block in the datastore and load it in on a fresh server (essentially getting every block placed in a way where I can loop through them)?
A block’s only tie to the player is in the ["Placer"]
component, but that’s it. I don’t want to just load only the player’s blocks that are within the server, but rather, load every block placed by anyone. There doesn’t seem to be a simple way using normal datastores, and I can’t think of a way to use ordered datastores with this form of data.
I’m not the best with datastores, so sorry if this is a silly question. Thanks!