Objetive
This is a messy script I am trying to organise, it’s not working. It’s supposed to capture the text from a textbox and when you press Submit button, it sends the content to a Discord channel.
I want to add +
I want to add the username of the person who submitted it and a cooldown, but I couldn’t find anything online. Any idea? Thanks.
-- Vayouls 2023 TRADEMARK
-- Variables
local gui = script.Parent
local textbox = gui.MainBoard.TextBox
local button = gui.MainBoard.Button
-- Get the HTTPService and the webhook URL
local http = game:GetService("HttpService")
local url = "pretend a webhook is here, i'm not revealing the original one" -- Discord Webhook
-- Ayesha Webhook
-- Function
local function sendSuggestion(text)
-- Create a table with the data to send
local data = {
["content"] = text -- The text of the suggestion
}
-- Encoding JSON...
data = http:JSONEncode(data)
http:PostAsync(url, data)
end
button.MouseButton1Click:Connect(function()
-- Get Text
local text = textbox.Text
-- NOT EMPTY Filter
if text ~= "" then
-- Send the suggestion to the discord channel
sendSuggestion(text)
-- Change the text back to the original one
textbox.Text = "Write a detailed suggestion, it will be sent to our staff team"
end
end)