Hello, I am trying to add a win system into my game that saves when between games not using a teleporter. Does anyone have an idea on how to do that.
Here is what I have so far:
local ds = game:GetService("DataStoreService"):GetGlobalDataStore()
game.Players.PlayerAdded:Connect(function(plr)
wait()
local plrkey = "id_"..plr.UserId
local save1 = plr.leaderstats.Wins
local Saved = ds:GetAsync(plrkey)
if Saved then
save1.Value = Saved[1]
else
local NumberForSaving = {save1.Value}
ds:GetAsync(plrkey, NumberForSaving)
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
ds:SetAsync("id_"..plr.UserId, {plr.leaderstats.Wins.Value})
end)
(The leaderstats and everything is in a separate script.)
1 Like
I advise you to create another place on the same game. Like this you can use the same DataStore. Because I don’t know of a way to synchronize 2 game data.
To add a new place in same game only go in View > Asset Manager > Places
Right click: Add New Places
Anyway to do it without adding a game inside of a game I want to have two separate games.
probably making an external server and using HttpsService to access it, but it you require you javascript/python knowledge to code & you would have to run a server (or buy one), I’m pretty sure if you search how to make roblox datastore using external servers something will pop-up, I already found some of these posts which gave a tutorial in how to do it and one even showing without needing to code at all. But it’s been a long time since I looked for them and I don’t know which/where/what are those pages anymore, like I said just keep searching until you find a good tutorial.