✓ Accepted answer
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
2 comments
You could try datastore service....
Yeah, I think that is the only way... But watch out, limit people to what they can write so they don't spam you.