How would I remove Data from my Datastore?

I am currently learning about datastore in Roblox. Sometimes it gets a little annoying not knowing how it fully works.

So I am making a DCO (difficulty chart obby) game and I am using datastore to save your progress. But I want to make a rebirth system and it won’t let me clear the leader stats value because the value comes from the datastore.

I want to know how would I clear my datastore data for the leader stats through a script.

3 Likes

You can set the value to 0 and save it.

Or

2 Likes

you can use DataStore:RemoveAsync()

like this:

local Datastore = game:GetService("DataStoreService"):GetDataStore("Datastore")

Datastore:SetAsync("hello",true) -- set something, just to test

Datastore:RemoveAsync("hello") -- hooray we removed it
1 Like

So you removed “hello” and now there is only true in the datastore?

No, true is the value stored in hello, removing hello from the datastore would make any future attempts to retrieve hello return nil because the key wouldn’t exist anymore

1 Like

no, it just stores the value “true” into the data store with the name “test” (like what @EmbatTheHybrid said)