I have a game that teleports you to a place inside the place. You guys know what I am talking about right? Anyways the wiki says places inside places can use the same data store but how would I go about doing this. I cant find any tutorials or anything.
Heres what ive done so far that hasent been working.
I have this data saving script inside the main place.
local DSService = game:GetService("DataStoreService"):GetDataStore("1302851773")
game.Players.PlayerAdded:connect(function(player)
local uniquekey = "id-" .. player.UserId
local leaderstats = Instance.new("IntValue", player)
local Units = Instance.new("IntValue", leaderstats)
local Crystals = Instance.new("IntValue", leaderstats)
leaderstats.Name = "leaderstats"
Units.Name = "Units"
Units.Parent = leaderstats
Crystals.Name = "Crystals"
Crystals.Parent = leaderstats
local GetSaved = DSService:GetAsync(uniquekey)
if GetSaved then
Units.Value = GetSaved[1]
Crystals.Value = GetSaved[1]
else
local NumbersForSaving = {Units.Value, Crystals.Value}
DSService:SetAsync(uniquekey, NumbersForSaving)
end
end)
game.Players.PlayerRemoving:connect(function(player)
local uniquekey = "id-" .. player.UserId
local Savetable = {player.leaderstats.Units.Value, player.leaderstats.Crystals.Value}
DSService:GetAsync(uniquekey, Savetable)
end)
And in the second place I have the exact same script. I was hoping it would work but it hasnt been. Anyone have any ideas?
Thank you for your time! :)

4 comments
Try using GlobalDataStore
local DSService = game:GetService("GlobalDataStore"):GetDataStore("1302851773") That errors and gives me a nil value?
I changed it to this and it also errors local DSService = game:GetService("GlobalDataStore"):GetGlobalDataStore("1302851773")
Well I changed it to this now and it doesnt error but it also doesnt save at all local DSService = game:GetService("DataStoreService"):GetGlobalDataStore("1302851773")