Questions About Datastore

When I was creating my platformer game I wanted to add coins but I dont want players to leave the game and come back for more. I want them to be one use coins. When taken by a player which is on a local script that deletes it and basically handles it, I dont know how I could go about datastoring the already collected coins so they dont spawn again. I thought of a bool value in each, if its true then the coin gets deleted. But is there a better way?

I don’t quite understand what you mean? If you want the coins to be a 1-time thing when a player picks it up why would you want to use a datastore? Just destroy via the server or on each client.

The bool value would work but you could create a table and add the coin to it when you collect the coin so the next time you join in the game you go through the table and delete the collected coins.
You would have to save the table via data store.

sorry for my bad explanation. its a platformer game but the player can get back to these areas. I dont want the player to leave the game and get these coins again. Basically i want to make sure the coins wouldnt respawn dispite it being a new server, specificially for that player.

would this work for high amounts like over 100? is there a better way to organize it then? OH! what if i saved a table for each area. Then i could cut up the amounts easier. how would i go through the table and delete the collected coins? Im guessing a script must run when a player joins. but how do i connect the table and physical coins on the map? (They are placed beforehand so they arent random)

you can create a table for each area, and remove the value from the table in the datastore when the player collects it. then when spawning it, you would spawn it by refrencing the table and only spawning in the tokens on the table. you could set it so that the table starts with all the positions but removes the positions as you collect them.

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