✓ Accepted answer
I know you said not to write a whole script but... I just had to
You don't have to copy/paste this as it is, but you can use it to better understand how it works
Server:
local DataStore = game:GetService("DataStoreService"):GetDataStore("SomeData")
local dsKey = "Feedback!@#$%"
local feedbackEvent = Instance.new("RemoteEvent", game:GetService("ReplicatedStorage"))
feedbackEvent.Name = "feedbackEvent"
local feedbackDebounce = {}
feedbackEvent.OnServerEvent:Connect(function(plr, msg)
if feedbackDebounce[plr.Name] then
return
end
feedbackDebounce[plr.Name] = true
DataStore:UpdateAsync(dsKey, function(data)
local data = data or {}
data[#data + 1] = plr.Name .. ": " .. msg
return data
end)
end)
game:GetService("Players").PlayerRemoving:Connect(function(plr)
feedbackDebounce[plr.Name] = nil
end)
game:GetService("Players").PlayerAdded:Connect(function(plr)
if plr.UserId == game.CreatorId then
plr.Chatted:Connect(function(m)
if #m >6 and m:sub(1,6) == "/view " and tonumber(m:sub(7)) ~= nil then
local toShow = {}
local limit = tonumber(m:sub(7))
DataStore:UpdateAsync(function(data)
limit = limit <= #data and limit or #data
for i=0,limit do
toShow[#toShow + 1] = data[1]
table.remove(data, 1)
end
feedbackEvent:FireClient(plr, "Print", toShow)
return data
end)
end
end)
end
end)
Client:
local textBox = script.Parent.TextBox
local button = script.Parent.Button
local feedbackEvent = game:GetService("ReplicatedStorage"):WaitForChild("feedbackEvent")
button.MouseButton1Click:Connect(function()
feedbackEvent:FireServer(textBox.Text)
end)
feedbackEvent.OnClientEvent:Connect(function(cmd, arg)
if cmd == "Print" then
print(table.concat(arg, "\n"))
end
end)
2 comments
Untested btw
Thanks for this! I will see if this works!