Basically, The Leaderstats work, but the DataStore doesn't when I stop game and run it, the Francs Currency doesn't work
local DataStore = game:GetService("DataStoreService"):GetDataStore("Francs") -- Change the text "Your Data store here" to a name you want"
-- If you don't want the leaderstats to save delete line 1, line 13 through 20
game.Players.PlayerAdded:connect(function(plr)
local leaderstats = Instance.new("IntValue", plr) -- Creates an Int Values inside of the player
leaderstats.Name = "leaderstats" -- Names the Int Value
Francs = Instance.new("IntValue", leaderstats) -- Creates another Int Value and parents it to leaderstats
Francs.Name = "Francs" -- Names the stat (CHANGE the "Your leaderstats here" text to anything you want)
local key = "plr-"..plr.UserId
local Saved = DataStore:GetAsync(key)
if Saved then
Francs.Value = Saved[1]
else
local ValuesToSave = {Francs.Value}
DataStore:SetAsync(key, ValuesToSave)
end
end)
game.Players.PlayerRemoving:connect(function(plr)
local key = "plr-"..plr.UserId
local valuesToSave = {Francs.Value}
DataStore:SetAsync(key, valuesToSave)
end)

4 comments
API is enabled, It's a Group Game. I change the value, but when I like reconnect through studio, it doesn't work, the value changes back to 0
DataStores don't work in studio. They only work in the real game.
I have had some scripts on the past, they would work on studio too?
No.