|
| 23 Apr 2017 10:14 AM |
How can I use RemoteFunctions to get a table I have from datastore?
|
|
|
| Report Abuse |
|
|
MiniNob
|
  |
| Joined: 14 May 2013 |
| Total Posts: 822 |
|
| |
|
| |
|
|
| 23 Apr 2017 10:23 AM |
just cuz
i need the data for a gui
|
|
|
| Report Abuse |
|
|
|
| 23 Apr 2017 10:26 AM |
| HttpService/JSON(Encode/Decode) |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2017 10:34 AM |
Those functions have literally nothing to do with this.
OP, post the code you already have.
|
|
|
| Report Abuse |
|
|
|
| 23 Apr 2017 10:37 AM |
the code's in 2 scripts
Basically, the 1st script makes a table based on a player's groups
game.Players.PlayerAdded:connect(function(Player) local PlayerKey = "user_" .. Player.userId local groupsTable = {} if Player:IsInGroup(2898623) then table.insert(groupsTable,"SISA") end DataStore:SetAsync(PlayerKey, groupsTable) end)
2nd script, Im making in a GUI that uses the table to add buttons
|
|
|
| Report Abuse |
|
|
|
| 23 Apr 2017 10:39 AM |
You're never reading the data that is saved.
|
|
|
| Report Abuse |
|
|
|
| 23 Apr 2017 10:42 AM |
i added this to the end of 1st to read it
local function sharetheTable() game.Players.PlayerAdded:connect(function(Player) local PlayerKey = "user_" .. Player.userId local groupsTable = DataStore:GetAsync(PlayerKey) HttpService:JSONDecode(groupsTable) end) end
ReplicatedStorage.TeamsDataStore.OnServerInvoke = sharetheTable()
|
|
|
| Report Abuse |
|
|
|
| 23 Apr 2017 10:53 AM |
in my GUI, how do I actually view the data from the InvokeServer?
|
|
|
| Report Abuse |
|
|
| |
|
|
| 23 Apr 2017 11:32 AM |
| return table when remote function is invoked |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2017 11:33 AM |
#unsub they can convert the table into a string and pass that string
|
|
|
| Report Abuse |
|
|
| |
|
|
| 23 Apr 2017 11:35 AM |
| tables can be returned but arrays are prioritized if there is also a dictionary part or you can return unpacked table data and compress it into a table on client |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2017 11:47 AM |
can I do this?
local groupsTable = TeamsDataStore:InvokeServer()
|
|
|
| Report Abuse |
|
|
|
| 23 Apr 2017 11:49 AM |
how would I return the table?
|
|
|
| Report Abuse |
|
|
|
| 23 Apr 2017 11:54 AM |
yes
if you want it in function form
local function getData( ... ) return remote:InvokeServer( ... ) end and there u go the ... is there just in case u need any arguments sent |
|
|
| Report Abuse |
|
|