Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to transport data from a second place to the starter place in the same universe?

Hello there, I'm having a problem with data storing. Let's say you were teleported to a place in the same universe with some data. The data loads in. However, when the player leaves the game and then re-enters the game, in the starter place, he doesn't receive that data.

My question is if it's possible to get the data from the second place and use it for the starter place for something else.

Here's a diagram of what I'm trying to achieve: diagram

1 answer

✓ Accepted answer

Okay. Here is an example script. Put these in both games, If you make the one game to the starter place and use this datastore script. Both leaderboards will save to each other (Put script it both games in serverscriptservice)

local DataStore = game:GetService("DataStoreService")
local ScoopizWoopiz = DataStore:GetDataStore("HeyItzScoopWasHere") --Change HeyItzScoopWasHere if you want lol

game.Players.PlayerAdded:connect(function(player)
	local leader = Instance.new("Folder", player)
	leader.Name = "leaderstats"
	
	local Money = Instance.new("IntValue", leader)
	Money.Name = "Money"
	
	Money.Value = ScoopizWoopiz:GetAsync(player.UserId) or 0
	ScoopizWoopiz:SetAsync(player.UserId, Money.Value)
	
	Money.Changed:connect(function()
		print("SavingData")
		ScoopizWoopiz:SetAsync(player.UserId, Money.Value)
	end)
	
end)

game.Players.PlayerRemoving:connect(function(player)
	ScoopizWoopiz:setAsync(player.UserId, player.leaderstats.Money.Value)
end)

2 comments

0

well, thanks for example but it's even more complicated than this. it's more than 20 values.

0

No problem dude!

This discussion is preserved as it was. New answers, comments, and votes are closed.