Why Isn't DataStore Showing in a Different Game in the Same Universe?

I have a leaderstats script which works in the game the script is located in, but when I try to access it in a different game (which is in the same universe) it doesn’t show up. How do I make it show up in the second game?

Main Game (:airplane: Overbooked)
image
Second Game (Game Place)
Screenshot_38
Game Hierarchy
image
Script:

local dsService = game:GetService("DataStoreService")
local ds = dsService:GetDataStore("Cash") 
 
game.Players.PlayerAdded:Connect(function(plr)
    local folder = Instance.new("Folder", plr)
	folder.Name = "leaderstats"

    local currency = Instance.new("IntValue", folder)
    currency.Name = "Cash"
   
	local data
	local success, errormessage = pcall(function()
		data = ds:GetAsync(plr.UserId.."-cash")
	end)

	if success then
		currency.Value = data
		print("Successfully loaded Cash data")
	else
		print("Error loading Cash data")
		warn(errormessage)
	end
end)
 
game.Players.PlayerRemoving:Connect(function(plr)
    local success, errormessage = pcall(function()
		ds:SetAsync(plr.UserId.."-cash", plr.leaderstats.Cash.Value)
	end)
	
	if success then
		print("Successfully saved Cash data")
	else
		print("Error saving Cash data")
		warn(errormessage)
	end
	
	game:BindToClose()
end)

I suggest looking into using Firebase to send data to the database and have the second database get the data from the database.

I can only presume that you have not enabled your game to have access to API service (which include Data Stores). Otherwise there is an issue with the script’s recording of data and sending of data.

P.S. If you do not understand what the script is doing then I suggest researching to get a better understanding of it.

The data saves fine, the leaderstats folder just doesnt show up in the second game.

Then, your leaderstats folder is missing because you did not have a script to make it. Have you checked that you got so script that will also load the data and create the leaderstats? (in the second game/place)

API services are enabled for both places, I understand how this script works, but I don’t understand why it isn’t loading my stats in the second place :thinking: