I've been working on my project, and it uses DataStores across a universe.
Here is script one
local datastore = game:GetService("DataStoreService"):GetDataStore("Vestige")
game.Players.PlayerRemoving:connect(function(leavingplayer)
wait(2)
local stats = leavingplayer:FindFirstChild("Statistics"):GetChildren()
for x = 1,#stats do
print(stats[x].Name)
end
end)
game.Players.PlayerAdded:connect(function(player)
wait(2)
local newstats = player:FindFirstChild("Statistics"):GetChildren()
for x = 1, #newstats do
newstats[x].Value = datastore:GetAsync(newstats[x].Name)
end
end)
Here is the script in the other place in the universe
local datastore = game:GetService("DataStoreService"):GetDataStore("Vestige")
script.Parent.MouseClick:connect(function(plr)
if plr.PlayerGui:findFirstChild("ScreenGui") then
print("already clicked")
else
local cl = script.Parent.ScreenGui:Clone()
cl.Parent = plr.PlayerGui
game.Players.PlayerRemoving:connect(function(leavingplayer)
leavingplayer.Statistics.Coins = leavingplayer.Statistics.Coins + 10
wait(2)
local stats = leavingplayer:FindFirstChild("Statistics"):GetChildren()
for x = 1,#stats do
print(stats[x].Name)
end
end)
end
end)
The GUI part of the second script works, but it doesn't add any more coins. Could anyone help?

2 comments
What is the problem exactly?
It doesn't save the coins. You're meant to get coins in one place, and they save into the statistics folder on the next place.