What is the default value of a BoolValue datastore?

I’m trying to make a BoolValue datastore to detect whether a player owns a vehicle. What is the default value of a BoolValue in the datastore? I’m planning to check whether it’s the default value or not, when the player tries to enter the vehicle.

1 Like

A DataStore is nil by default because there isn’t a value yet.

Just do

if data then
  -- player has data
end

You can’t save instances to a datastore. What you likely are doing is storing a boolean such as true or false.

GetAsync will return nil if no value has been saved to the key yet, so that’s your default value.

local data = SomeGetAsyncCall()
if data == nil then --You could also do not data since nil is not a truthy value, but nil guarantees data has not been saved so if you want to default a value to true this is better
   --no data saved
end

Without seeing how you’ve setup your code I can’t provide much more information.