Datastores Error: attempt to index number with 'IncrementAsync'

Got the error attempt to index number with ‘IncrementAsync’ when i was doing some testing with checkpoint saving. Got this error in this code:

success2, newCheck = pcall(function()

return checkpoint:IncrementAsync(“C0d3k1d”, 1)

end)

Can you show the part of the code where you assign the ‘checkpoint’ variable?

1 Like

local checkpoint = DataStoreService:GetDataStore(“Checkpoint”)

Are you ever assigning another value to checkpoint or are you creating a new variable called “checkpoint” inside of the scope?

just saw this- the checkpoint is the DataStoreService:GetDataStore(“Checkpoint”)

Yes but are you ever assigning another value to checkpoint?

Yeah, i started it as 0
(ttttt)

That’s why, you have to increment the datastore, not the number.

First time messing with them, so yeah ill mess with it a bit and see if i can get it

1 Like

I can probably just use SetAsync with an if to check if the player is past it