SuggestionManager Script - (ServerScriptStorage)
01 | local HttpService = game:GetService( "HttpService" ) |
02 | local WebhookURL = "https:/wlSrdTP6FvqGPcwE7QZuidoaHoef3nV0iz_-HZkc6-H6U7b0En" --<<--WEBHOOK URL HERE |
03 |
04 | local function postToDiscord(Message) |
05 | local Data = { |
06 | [ "content" ] = Message |
07 | } |
08 | Data = HttpService:JSONEncode(Data) |
09 | HttpService:PostAsync(WebhookURL, Data) |
10 | end |
11 |
12 | game.ReplicatedStorage.Suggest.OnServerEvent:Connect( function (Player, Suggestion) |
13 | postToDiscord( "Suggestion from " .. Player.Name .. ": " .. Suggestion) |
14 | end ) |
SuggestionScript - (StarterGui)
01 | local Player = game.Players.LocalPlayer |
02 | local ToggleButton = script.Parent.ToggleButton |
03 | local SuggestionFrame = script.Parent.SuggestionFrame |
04 | local SuggestionBox = SuggestionFrame.SuggestionBox |
05 | local SubmitButton = SuggestionFrame.SubmitButton |
06 |
07 |
08 | ToggleButton.MouseButton 1 Click:Connect( function () |
09 | if SuggestionFrame.Visible = = true then |
10 | SuggestionFrame.Visible = false |
11 | else |
12 | SuggestionFrame.Visible = true |
13 | end |
14 | end ) |
15 |
16 | SubmitButton.MouseButton 1 Click:Connect( function () |
17 | local Suggestion = SuggestionBox.Text |
18 | game.ReplicatedStorage.Suggest:FireServer(Suggestion) |
19 | end ) |
The Map for the GUI is
1 | StarterGUI |
2 | |_ |
3 | SuggestionGUI |
4 | |_ |
5 | SuggestionScript |
6 | Suggestion Frame _ |
7 | |_ |
8 | SubmitButton |
9 | SuggestionBox |
You did not use a debounce.
A debounce is used for that occasion.
01 | local Debounce = false |
02 | local Player = game.Players.LocalPlayer |
03 | local ToggleButton = script.Parent.ToggleButton |
04 | local SuggestionFrame = script.Parent.SuggestionFrame |
05 | local SuggestionBox = SuggestionFrame.SuggestionBox |
06 | local SubmitButton = SuggestionFrame.SubmitButton |
07 |
08 |
09 | ToggleButton.MouseButton 1 Click:Connect( function () |
10 | if SuggestionFrame.Visible = = true then |
11 | SuggestionFrame.Visible = false |
12 | else |
13 | SuggestionFrame.Visible = true |
14 | end |
15 | end ) |
I hope this helps.