Is memory store service shared across sub-places?

I want to know if memory stores are shared across sub-places. If not, what can I do to achieve a similar result?

They are.

1 Like

Really? So if I’ve got this type of game:

Game = {
   "Place1", "Place2", "Place3", "Place4"
}

And a memory store:

local MSS = game:GetService("MemoryStoreService")
local queue = MSS:GetQueue("newQueue")

The queue will be shared across ALL sub-places and servers, or only the main place and not the sub-places? And if I want a memory store to only share data across the main place, such as a game lobby, to detect any players joining from other servers, and print their name, how could I do that?

I’ve never tied it but from everything I’ve read and looked it … it can.

I’m not sure if that’s true; from everything I’ve read about Memory store is just able to handle servers’ data, not an entire game with sub-places.

I really can’t say for sure, I’ve never tried it. I think it can but, I would actually have to prove that to myself to say for sure.

Ok a bit of quick research…

If you have a game with multiple places within it (part of the same main game), they all share the same DataStore. You can save data in one place and access it from another, as long as they’re within the same game (aka: within the same Universe).

Basic data set up…

local DataStoreService = game:GetService("DataStoreService")
local playerDataStore = DataStoreService:GetDataStore("PlayerData")

game.Players.PlayerAdded:Connect(function(player)
    local success, data = pcall(function()
        return playerDataStore:GetAsync("User_" .. player.UserId)
    end)
    if success and data then
        --load the player data
    else
        --create new player data
    end
end)

game.Players.PlayerRemoving:Connect(function(player)
    local dataToSave = {
        --save player's data
    }
    pcall(function()
        playerDataStore:SetAsync("User_" .. player.UserId, dataToSave)
    end)
end)

This would have to be in each place and the main game. I would make this part generic, as in this is all it is doing in each game, then have other scripts apply said data. Of course, you could probably skip --create new player data in the places within the main game.

1 Like