Help with DataStore between places in same universe

I am hoping to achieve a living DataStore system within a universe of places for a story game.

  • Inside each place there would be the ability to send data back to the start place or other places upon player progression.

  • The data would be retrievable across all places within the experience’s universe.

  • Save the players progress when they reach a checkpoint or cutscene. Have it save as a table as to allow the easy saving and loading of lots of different data at once.

Example:

DataStore["Save1"] = {
	LastCheckpoint = "Checkpoint_13_L", 
	CurrentWorld = "Chapter 2", 
	Progress = 54, -- % Progress
	LastPlayed = 12244122312312, 
	CollectiblesFound = { 
		Collectible1 = false,
		Collectible2 = true,
		Collectible3 = true
	},
	DoorsOpen = { 
		Door_1_R = true,
		Door_2_L = false
	},
	CurrentPlayerData = { 
		Health = 150,
		MaxHealth = 200,
		IsHurt = true
	}
	-- And so on
}

I probably sound like I’m asking for a lot, but I’d just like to have some guidance and examples that would help me understand and thus aid in creating this system for my game. Thanks.

You can save user data with DataStoreService using :GetAsync() and :SetAsync(). So every time you save data, you need to use :SetAsync() and that data will then be readable in all places, by using :GetAsync(). Reminder tho that these commands also fail, so it is recommended to add a pcall and rejoin the player when their data didn’t load correctly.

Example script:

game.Players.PlayerAdded:Connect(function(plr)
        local dss = game:GetService("DataStoreService")
        --get your data using :GetAsync()
        -- do stuff with it
end)

I’m not gonna write a whole script right now since I don’t want anything to not work, but when I get home and if this post is still up by then, I’ll write a complete code to help you understand. :slightly_smiling_face:

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