I click on test, 2 Players and it kicks both players because it cannot load the datastore.
I click on test, 1 Player and it works fine.
The live game also works fine with multiple players.
It used to work, now it doesn’t.
CODE:
local dataStoreService = game:GetService("DataStoreService")
local dataStore = dataStoreService:GetDataStore("Testing")
game.Players.PlayerAdded:Connect(function(player)
local success, value = pcall(dataStore.GetAsync, dataStore, player.UserId)
if success == false then player:Kick("Data could not be loaded! Please rejoin.") return end
When you playtest with only a single player it will use that players UserId. When you playtest with multiple players it gives them false userids in the form of -1, -2, -3 etc so that’s what is probably causing your issues.
Wouldnt be a good idea, but because of the inactivity of the accounts, it would work? But I would recommend keeping it as a negative value, just to be sure.
Are you using the UserIds table when saving the data? Perhaps you should check there if it is a negative number too and if it is, then don’t use the userids table for that data. I understand that you are seeing the error when attempting to load the data, but I just want to confirm this as it will likely cause saving errors.
I am unsure as to why this would cause a retrieval error. Considering they are valid keys. Perhaps access to the data store service is being blocked for some reason.
Is studio access to API services on? If not, that will be the problem.
It is unlikely, but otherwise, it could be blocked by an antivirus or something.