EDIT:
Datastore saving seems to be working, but for some reason it doesnt work in studio when you leave play mode. The code below shows datastore saving and loading in the same game session without leaving.
DataStoreService = game:GetService("DataStoreService")
HttpService = game:GetService("HttpService")
DataStore = DataStoreService:GetDataStore("Test1")
game.Players.PlayerAdded:Connect(function(player)
local key = player.userId
local SaveTable = {}
local key = player.userId
SaveTable["NOOB"] = true
local EncodedSavedValues = HttpService:JSONEncode(SaveTable)
local suc,err = pcall(function()
DataStore:UpdateAsync(key,function(oldData)
return HttpService:JSONEncode(SaveTable)
end)
end)
local EncodedData
local suc,err = pcall(function()
EncodedData = DataStore:GetAsync(key)
end)
print(EncodedData)
if suc and EncodedData and HttpService:JSONDecode(EncodedData) then
local Data = HttpService:JSONDecode(EncodedData)
print(Data["NOOB"])
end
end)
You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
Saving datastore in studio to be able to debug easier.
- What is the issue? Include screenshots / videos if possible!
This issue didnt happen as far as I know since 2018. Roblox did alot of updates and options were moved all over the place. I made sure to enable studio api and datastore, but nothing seemed to work.
TL;DR Datastore saves fine ingame but it wont save in studio.
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have searched for posts several hours regarding this issue. Mostly they dont seem to be specific enough to cover this issue. I am sure my implementation should be fine.
These are the options I have for my datastore.
Dont be mislead by Datastore2. This is just the name of the place and not in any ways related to the module!
As I said before it works fine when I play ingame where it saves, but Ive been spending many hours trying to figure out why it doesnt save in studio.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
I tried creating the simplest datastore script just for testing purposes. My original script has a very complex array that saves.
DataStoreService = game:GetService("DataStoreService")
HttpService = game:GetService("HttpService")
DataStore = DataStoreService:GetDataStore("Test")
game.Players.PlayerAdded:Connect(function(player)
local key = player.userId
local EncodedData
local suc,err = pcall(function()
EncodedData = DataStore:GetAsync(key) -- always returns nil
end)
if suc and EncodedData and HttpService:JSONDecode(EncodedData) then
local Data = HttpService:JSONDecode(EncodedData)
print(Data["NOOB"])
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local SaveTable = {}
local key = player.userId
SaveTable["NOOB"] = true
local EncodedSavedValues = HttpService:JSONEncode(SaveTable)
print(EncodedSavedValues)
DataStore:SetAsync(key,EncodedSavedValues)
end)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
I am aware that I might have missed out on an option for turning on this for studio. I just dont understand why it should be this nested just to find this property.



