How can I get multiple data from a datastore save

So for example, you wanna save the player’s name and a tool their holding. You save that using datastores and upon next time you join the game you want the player to be given the tool saved with his name. This would look something like this: Player - Tool.

You get the data from the datastore but how can you separate it? so you end up with the player and tool being separate things and print them out like: print(Player) print(Tool)

1 Like

You can save tables in a datastore as long as they are serializable.

A table like this can be saved.

{
	Name = "some name",
	Tool = "some tool"
}
1 Like

You can use the suggested table method (which is way better) above, or you can use string.split to split the string.
If your data is PlayerID-Toolname, then you can use string.split(string, "-") to seperate it.
The result would be {PlayerID,Toolname}

Also, please use the Player’s id instead of the name. The Player name can change, playerid can not.

1 Like

Like @Blokav said, the most efficient way to save data is using tables. You also have to have a tool in ServerStorage. When the player joins the game you can access the data from the table and you can clone the tool from ServerStorage and parent it to the player’s backpack.