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

Using DataStore

Asked by 11 years ago

I'm trying to figure out how I can save and update a "key" in the datastore with a table. I've never used DataStore before so I'm trying to figure out how it works.

I have{plr.Name, servername, password, public};and I want to save that to the next position in the serverList table.

01serverData = game:GetService("DataStoreService"):GetDataStore("ds")
02serverList = {}
03if serverData:GetAsync("Servers") then
04    serverData:SetAsync("servers", serverData:GetAsync("servers"))
05else
06    serverData:SetAsync("servers", serverList)
07end
08 
09 
10function Workspace.createServer.OnServerInvoke(plr, servername, password, password2)
11    print(plr.userId)
12    local public = false
13    if password2 ~= "" then
14        print(plr.Name.." wishes to create a server called "..servername.." with the password "..password)
15        public = false
View all 22 lines...

1 answer

Log in to vote
6
Answered by
Azarth 3141 Moderation Voter Community Moderator
11 years ago
1serverList[#serverList+1] = {plr.Name, servername, password, public}
Ad

Answer this question