How do you change data from another script?

Hey this is my first time ever working with a datastore and I want to know how you can change the value of something from another script? I am trying to make it so in my round system when a player finishes the game it will add 1 to the players data (gamesplayed, [number])

You can use the datastore across different scripts. Also what’re you changing? A variable or an instance value

1 Like

Number value

β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”-

What’s preventing you from accessing and changing the number value directly? Are these two scripts server scripts?

Data is uploaded and downloaded. The downloaded data has to be stored somewhere. Most games will use session tables that are manually replicated or given a facet for querying by the client. There are more elementary methods that involve value instances stored under a client’s Player instance. Both provide opportunities for communal access.

Value instances are easy enough to read and write to from any location. Session tables are usually managed by a ModuleScript which scripts import and request access to the session data

1 Like

Like what do I use? Updateaysnc()?

It’s not recommended that you write to the data-store each time you want to update player-data. That is why session tables and value instances exist

1 Like

I used a session table so when do something it gets saved to the table and then when they leave the table gets added to the datastore

1 Like

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