I was wondering what would be the best way to create a achievement/quest saving system. I currently have a checkpoint system which consists of 25 checkpoint parts. If the player touches one of those checkpoints, their position will be saved for when they leave, die or rejoin the game. A checkpoint leaderstat will also be set to what checkpoint number the player has recently touched. I am trying to make it where if the player reaches checkpoint 5 for example, a textlabel will change background colour (green for example). Then whenever the player dies, leaves or rejoins the game that textlabel will always be green for that player. How could I go about doing this? I know that I need to use datastores but am not sure if I should use a module script for this or not. Thanks.
You could maybe use DataStore or DataStore2? The best way of doing that would probably be an attribute.
You will most definitely need to use datastores for this! It does not matter whether or not use a module script or a regular server script to handle your datastore, as long as you are properly loading / saving your data and giving your player access to their data to change their UI locally, then you are doing it properly. Here’s the steps that I would suggest taking.
- When the player joins, load their data. When their data is SUCCESSFULLY loaded, create a leaderstats for the player and assign the “Checkpoint” value whatever their data says it is.
- In the UI controller, make the player wait until their leaderstats and checkpoint value is loaded in the player. Then change the UI according to what the checkpoint value says.
- When the player leaves, check what their checkpoint value in their leaderstats is, assign their data and save!
I hope this was helpful!
Thanks for the response. Also apologies in advance, I am on the newer side to programming. So you recommend having a DataController script in ServerScriptService that will handle and create a leaderstat for each player when they join. And then also a UI controller script somewhere in StarterGui?
That’s exactly right! Server script for datastores, Local script for UI!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.