Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How can you transfer one data from one server to another?

Asked by 6 years ago

So, I am making a little place to where if i were to enter a command, like :save data [username] [increment # of rules they've broken], it would internally store the data, and if I were to call on it again, it would print it on that chat to the server. I thoroughly have no idea on how to do this, and if someone could help, it'd be greatly appreciated. Thank you!

Here would be an example:

[epicly2000]: :save data Builderman 2 [Server]: Has incremented Builderman's number of rules broken by 2 [epicly2000]: :show Builderman [Server]: Builderman has broken 2 rules logs off then back on to another server [epicly2000]: save data Buiderman 3 [Server]: Has incremented Builderman's number of rules broken by 3 [epicly2000]: show Builderman [Server]: Builderman has broken 5 rules

0
I don't know how to fix this, but have you tried using a sort of DataStore for rules broken on the leaderstats? That could work, but I don't know JellyYn 70 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago

If you have the actual datastorage setup so it saves you can simply use universes Use this and read trough it!

Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

A DataStore is what you would use unless you plan on using an external service which you would need to use then HttpService.

If you have not use a DataStore before I recommend you first look at some of the tutorials to get a better understanding of what a DataStore can do. More importantly it is critical to know the limitations of a DataStore.

DataStore tutorial links:-

Recommendations

As a DataStores are shared between places within a universe allowing all places to access the same DataStore. This can be both good and bad.

Though it is up to you on the format of the saved data (within the DataStore limits) the simplest method would be to use the playerId with the DataStore function IncrementAsync as it focuses only on integer type data (whole numbers only)

Example of saving data:-

-- get the data store
local ds = game:GetService('DataStoreService'):GetDataStore('test')

local function incKey(key)
    ds:IncrementAsync(key, 1) -- inc the key by one
end

incKey('52555697') -- inc your key

This is just a basic example and the data store functions for saving and loading data should be put inside a pcall to detect any errors in accessing or saving data.

For the command part you would probably be best using patterns to split the string into usable data ie [command] [player name] [args ...]

I hope this helps

Answer this question