Move data from one to another

So in the first donation board there is the datastorage script, and a person donated. So how should I move the data from the first donation board to the second one and what script?

3 Likes

Can’t you just click and drag it to the new donation board?

1 Like

I tried but it didn’t work :frowning: .

So guys if I want to move the storage from one to another, what should I write in key,value?

You can use the same key for storing and retrieving the data. Since a data key is local to the game.

You can just use the way you save the data.

When you retrieve:

DataStore:GetAsync(player.UserId .. "_donations") -- (key can be the same string you save your data with: player.UserId .. "_donations"

When you save:

DataStore:SetAsync(player.UserId .. "_donations", {})  

Final Script:

The reason we use UserId is every player should have a unique data, or the data might get overwritten, I do prefer you to read about the DataStoreSevice api.

(GlobalDataStore | Roblox Creator Documentation)
(GlobalDataStore | Roblox Creator Documentation)
(GlobalDataStore | Roblox Creator Documentation)

local dss = game:GetService("DataStoreService")

-- when a donation is made
DataStore:SetAsync(player.UserId .. "_donations", {})  -- the table refers to the data that should be saved 
{
   ["SomeValue"] = value.Value;
};

-- get the donation
DataStoreService:GetAsync(player.UserId .. "_donations")
1 Like

Thanks!! But here it says _donations… What should I put before the underscore?

Player | Roblox Creator Documentation, the … is called concatenation, you can also format it.

string.format("%s_donations", player.UserId)

So i need to write the player’s id who donated…ok!

You need to create a unique key for every player.

1 Like

Well lucky me i only got 1 donation so I don’t need to do a lot of work :wink: .

Well that’s sad, I wonder why it didn’t work. :thinking:

1 Like

@paw1001010 what should I do about these red lines?
image

You have to actually reference datastore service correctly and reference your values right.
You also didn’t make a function to pass over the player variable so now, it doesn’t know which player you’re saving data to.

1 Like

I do have a datastore on my old board. And the person’s name is @ffeerrhhaatt .

I think you haven’t understood on how to do this, take a look at (Roblox DataStore Tutorial - Data Stores & Saving Data - Scripting Tutorial - YouTube), and use your own logic, it’s recommended that you’re clear with the basics on how to code.

1 Like

I watched that before, but it doesn’t say how to sync data… so if you want I can turn on team create and you can tell me in the game what to do.

You obviously do not understand what I mean. You referenced DataStoreService as a variable called “dss”, yet you used the wrong variable for “DataStore” and “DataStoreService”. If you don’t know how to use variables, I suggest moving down a level and trying something else without DataStores.

Also, I’m saying that you didn’t specify which player you’re saving data to as you never referenced who the player was in your script.

I did add his ID in the script.

What do you mean by sync lol? I believe you’re a beginner, so I did suggest you to choose paths on learning on how to do this, this category is for helping, not for creating your system.

1 Like