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

Interesting Use of DataStores, any better way to do this?

Asked by 9 years ago

I have been thinking of a way to allow people to make a comment, report a bug, or give a suggestion in game in real time. I have the Gui all set up but I am not sure how to get around saving and accessing this data. I could make a global key where I could add tables inside it sort of like this:

01bugs=game:GetService("DataStoreService"):GetDataStore("Bugs")
02local addbug=Instance.new("RemoteFunction", game.Workspace.remote)
03addbug.Name="addbug"
04function addbug.OnServerInvoke(player, text)
05    local tabl=bugs:GetAsnync("main")
06    repeat
07        wait(1)
08    until tabl~=nil
09    table.insert(tabl, {player, tostring(os.time()), text})
10    bugs:SetAsync(tabl)
11    return true
12end

Now, this will put a table into the main key. I'm not sure how well this will work but I'm not sure how else to do it. I will have a system that I can view everything in it with another Gui and can refresh it in real time. Is there a better way to do this type of thing? (I am just getting use to how data stores work so I am thankful for any pointers or help)

Answer this question