Accessing DataStores from different places with ProfileService

Say I have a dungeon crawler game, and I want to send Data about the players inventory and equipped items, etc. to the dungeon when they teleport

I get that I can use TeleportService to send data to the dungeon and then another TeleportService to send data back to the main server so that it can be saved there (such as the loot that the player dropped)

However, what if the player leaves before the dungeon is complete, and doesn’t teleport back. He may have still gotten XP, but that wouldn’t have been saved.

So is there a way to access a shared DataStore between experiences?

i mean usually in a dungeon game you shouldn’t recieve anything you earned inside the dungeon unless you complete it, if you wanted to make it so you keep the xp even if you leave or fail then it wouldn’t really make sense cause people could just farm xp over and over and it ruins the whole point of the game, finishing the dungeon

hmm fair, but this was more of an example. Does the concept of a shared datastore exist?

Apparently, “By default, DataStores carry over to different places inside a single game.”

Therefore how would I access the same datastore from different places?

The exact same way you would do it normally.

So just

GetDataStore(name)

right?

Ok thanks for that, but do you know of a way of doing this in ProfileService? If I simply state

GetProfileStore(name)

in a different place, it returns an error that I didn’t pass the second argument, which is used to set a default for that datastore, but I don’t believe I need a template here.

You do need a template. That template is also used for reconciling, so it isn’t just a default.

3 Likes

Oh, alright ill try that real quick. I just put an empty table for now

Ah damn you were right, thanks for the help

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.