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:

bugs=game:GetService("DataStoreService"):GetDataStore("Bugs")
local addbug=Instance.new("RemoteFunction", game.Workspace.remote)
addbug.Name="addbug"
function addbug.OnServerInvoke(player, text)
    local tabl=bugs:GetAsnync("main")
    repeat
        wait(1)
    until tabl~=nil
    table.insert(tabl, {player, tostring(os.time()), text})
    bugs:SetAsync(tabl)
    return true
end

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