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

How would I go about making a bug reporting feature?

Asked by 5 years ago

I'm thinking about having a bug reporting feature for a game I'm working on. Where you can type whatever bug you encounter in the game and submit it for me to view. However, I have no idea how to go about sending the bug to me, so how would I go about doing that?

Thanks! :^)

0
You could try datastore service.... KingLoneCat 2642 — 5y
0
Yeah, I think that is the only way... But watch out, limit people to what they can write so they don't spam you. greenhamster1 180 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

Hi dylan,

When I commented you can try data store service, I was only 95% sure. Then, I made it just now in like 30 minutes and it works. I just saved the string that people put in for the bug, into a DataStore. You can see the game I made it in right here, and I'll also allow you to copy the game so you can study my scripts. The whole data store thingy is in ServerScriptService, and the string is sent from StarterGui. You can see all the bugs that were reported by typing '#bugs' into chat. I made the script print all of them when you type that. Also, make sure you're included in the admin list. You'll need to be in that to view the bugs.

I'll post the data store script below but, I advise checking out that game and seeing all my scripts with the whole hierarchy there, it's much more efficient.

ServerScript inside ServerScriptService which saves data.

local ds = game:GetService("DataStoreService"):GetDataStore("Bug Reports");
local players = game:GetService("Players");
local rs = game:GetService("ReplicatedStorage");
local add_ev = rs:WaitForChild("Add Bug");
local key = "Bug Reports"
local admins = {
    ["KingLoneCat"] = true;
    ["dylan5225"] = true;
}

players.PlayerAdded:Connect(function(plr)
    if admins[plr.Name] then
        plr.Chatted:Connect(function(msg)
            if msg == "#bugs" then
                local bugs = ds:GetAsync(key);

                if bugs then
                    for _, bug in next, bugs do
                        print(bug);
                    end
                end
            end
        end)
    end
end)

function add_bug(plr, str)
    local vals_already_there = ds:GetAsync(key);
    local data_to_save;

    if vals_already_there then
        vals_already_there[#vals_already_there + 1] = str;
        data_to_save = vals_already_there;
    else
        data_to_save = {str};
    end

    ds:SetAsync(key, data_to_save)
end

add_ev.OnServerEvent:Connect(add_bug);

Well, I hope I helped and yes, I did the saving through RemoteEvents, because it was easier in my opinion.

Thanks,

Best regards,

~~ KingLoneCat

Ad

Answer this question