Heya. I'm trying to get the game to check if the player has visited before, and if not, then set the Async to "1" and continue incrementing for that player each time he/she joins. I read up on the forum, and I unfortunately need to check the key before I set it. Thanks!
local hasJoined = ds:GetAsync(newplayer.Name.."_JOIN") if hasJoined == nil then isprevioususer = 0 ds:SetAsync(newplayer.Name.."_JOIN", 1) elseif hasJoined >= 1 then isprevioususer = hasJoined ds:IncrementAsync(newplayer.Name.."_JOIN", 1) end
I heard of this problem somewhere. Replace line 2 with
if not hasJoined then
If that doesn't work then try
if type(hasJoined) ~= number then
I believe an empty key in a data store returns something but not nil.