Still have questions? Join our Discord server and get real time help.
2

# What is the Value of a newly created Data Store?

When a player joins and you use :GetDataStore() I believe it will create the new one with the name inside. So, now that a new DataStore was created i'll call it Storage for this question. The Key of Storage will be the name you put in :GetDataStore() , so what will its value be? Will the value be nil or will it be 0 ?

I'm asking because say I wanted to see if this is a new DataStore, I want to check to see if they have the new starting value and if so, change is using :SetAsync() so the value will be something that'll probably give starting gear in another script (This is not what i'm accomplishing, i'm making this up to show what I mean).

So again, What's the Value for a newly created Data Store?

2
BlueTaslem 17371
4 years ago

GetAsync(key)

Returns the value of the entry in the DataStore with the given key. If the key does not exist, returns nil. This function caches for about 10 seconds: you cannot be sure that this function returns the actual value saved on the roblox servers.

It wouldn't make sense for it to return 0, since it doesn't know you'll expect a number (most things saved are probably not numbers) -- unlike data persistence, you don't ask for a type of thing, just give where it is.

1. References like the Wiki are your friend!

0
Oh, I should have noticed that, lol. Where do you figure out all of the things to add in an answer? Like, their are Dots i've seen you do and so on that make it look better, how do you know them? alphawolvess 1673 — 4y