Check if DataStore Exists

So Im making a file control system. Would this work to see if there is a file that exists?

DataStore:GetAsync("idk")
if nil
-- Not Existing Code Here

Definitely not that exact script. This would work though.

local data = DataStore:GetAsync( "Idk")
If data == nil then
-- What u want to happen if data doesn't exist.
end

Or this:

If data ~= nil then
-- What u want to happen if data *DOES* exist.
end``
2 Likes