Doubt about shared datastore for multiplayer placement system and something else

I have a doubt about the datastore, I am making a farm game with a maximum of four players per server, and I am saving the player’s data using the player id as key, but I have a doubt about the placement system, I am also supposed to save them but I can’t associate it to the player id, the four players are supposed to have access to all the objects placed on the map.

¿How can I make sure that the four players that build stay together and that they always connect to the same server and share objects?

I think I have heard that you can use an http api and I think that would make things easier but I want to know if there are alternatives with datastores, although I repeat that I am not familiar with them.

Sounds like you are attempting to tie the data of 4 unique player ids together into one shared data access point? If I’m wrong, correct me. I would agree there would probably be some “ease of access” by implementing an external http api, however, I do believe (in theory), this would also be possible using only Roblox api.

I’m not sure if the following example will be applicable to your situation, but maybe it is or maybe it will spark some idea that you’ll be able to use:

Let’s consider a situation where you want the data of 4 specific players to be tied together. First, one player would need to form some sort of team, then add other players into it. When that first player creates that team, you can create the datastore for that particular player’s plot (the grid placement representation), also you can create an separate entry into a different data store for the associated team. Keep in mind the player’s data should remain separate from the team’s data. The entry into the data store for the player’s data would store any information you need to locally reconstruct the placed objects. The entry into the data store for team information might include data such as the team name, and its members. I could see it being feasible to associate a player’s userID to a team by storing the unique teamID under a data store associated with that specific player. When the game loads in, it can check whether or not there exists a data store for that player’s associated team. If it successfully finds one, then it can access the data store associated with the specific team and also load the data from the corresponding users also linked under that team. The following tables might help you to visualize how I think this could be set up:

--Specific player's data
   TeamID = 0x012345678, --This is a reference to the team/group a player is on. If they are not on a team, this value might be 0 or nil
   Plot = {} --This would contain whatever representation you choose to adequately describe the player's plot/building site

--Team data
   TeamName = "GoVikings",  --This property is specific to the team/group and you may include other properties as you see fit
   TeamMembers = {
      28699584,   --Each entry is the unique userID of each player on the team

Obviously, this method relies implicitly on JSON Encoding and Decoding (
Also, you’ll need to work out how to load the data in cases where one, or some, of the player’s of a team are already online, and therefore a local version of the data loaded from data stores already exists.

1 Like