✓ Accepted answer
GetAsync returns void if no result exists. As far as i know that is not intentional and is a bug, however, since in Lua void variables do NOT exist, you can count that as nil and following code will print out true:
print(inventory:GetAsync("arwjrje") == nil)
If you declare a variable pointing to void then it will be set to nil automatically so this example will print out nil as you expected:
local result = inventory:GetAsync("aewjrje")
print(result)
The reason why it printed blank text is because putting void into parameters is like not putting anything in them so your code is basically calling print()
Note when using data stores, it is crucial to use pcall since if the servers are down, your thread is going to break and you won't be able to do anything with that. This function runs given function and stops it if it throws an error without affecting thread that called it.
It returns boolean representing if the function ran without errors and a string as an error message if it errored. If the function did NOT error, it will return boolean as the first value as usual and all next values it will return will be the values that function you passed in returns, in practice you would use it like this:
local success, response = pcall(inventory.GetAsync, inventory)
if success then
if response then
else
end
else
warn("Failed to get data: " .. response)
end