If this function throws an error, the error message will describe the problem. A full list of DataStore errors can be seen here.
In the following example we will use a DataStore to increase the value of a key, so as to reflect how many times a player has visited your game. Due to IncrementAsync returning the incremented value, we can award the player based on how many times they have visited.
local DataStore = game:GetService("DataStoreService"):GetDataStore("PlayerVisits") game.Players.PlayerAdded:connect(function(Player) local PlayerKey = "user_" .. Player.userId local Visits = DataStore:IncrementAsync(PlayerKey, 1) if Visits == 10 then --// Reward them for visiting ten times. end end)