Overwriting keys
Using DataStoreService
, the only way you can change a value is by overwriting
the former. The same thing applies with removing keys or values as well. Just like how you'd "remove" a variable in a script by setting it to nil
, you'd do the same thing in data store with whatever set method you're using (SetAsync
, UpdateAsync
, etc) - just save a nil value. Here's an example:
1 | local data = game:GetService( "DataStoreService" ):GetDataStore( "Test" ) |
2 | data:SetAsync( "Key" , "Hello there" ) |
6 | data:SetAsync( "Key" , nil ) |
That's about it, simple as that. Let me know if you have any questions!