Alright, so I have the amount set up as a DataStore right now, and it doesn't always save properly, for it says there's 30 people online when there's only 9. Is there any way to fix that? If so, please explain to me how I would do so.
Code in game I want to see the players:
local DataStore = game:GetService('DataStoreService')
local Albany = DataStore:GetDataStore('Albany')
game.Players.PlayerAdded:connect(function(player)
local key = "Albany"
Albany:UpdateAsync(key, function(oldValue)
local newValue = oldValue or 0
newValue = newValue + 1
return newValue
end)
end)
game.Players.PlayerRemoving:connect(function(oldValue)
local key = "Albany"
Albany:UpdateAsync(key, function(oldValue)
local newValue = oldValue or 0
newValue = newValue - 1
return newValue
end)
end)
game.OnClose = function()
wait(3)
end
In the other game, I just grab the DataStore
