Dummy Studio Player clients causing trouble for my orderedDataStores

I do not know what caused this, but recently the dummy studio clients you can use such as Player1 and Player2, their data has been saving onto the acutal game. This is an issue, because the OrderedDataStores can’t find a player with the userId -1, and crash the script so that any legit player that has a value less than those dummy players does not exist.

How would I fix this?

Is StudioAccessToAPIServicesAllowed enabled?

Yes, but is that not for API services in general, not just studio? I thought you had to enable that for datastores to work.

Enabling that allows Studio to write to game-wide datastores. Use a separate place for datastore testing. (iirc)

1 Like

So it’s all or nothing correct? There is no way to allow datastores to work in-game and not in studio? I like the separate place idea but I was hoping for something easier.

You could use different datastore names.

local RS = game:GetService("RunService")
local DSS = game:GetService("DataStoreService")
local datastore = nil

if RS:IsStudio() then
    datastore = DSS:GetOrderedDataStore("studiokey")
else
    datastore = DSS:GetOrderedDataStore("gamekey")
end
1 Like

That’s smart. To fix the current issue i just automatically set all dummy key values to -10, and I already have a system of keytags if i need to reset the data during testing, so your idea should be easy to implement, thank you!

1 Like