Is there any way to prevent the webhook message from sending to discord if the textbox is empty

Is there any way to prevent the message from sending to discord if the textbox is empty

local HttpService = game:GetService("HttpService")
local Webhook = game.ReplicatedStorage.Webhook.Value
local player = game:GetService("Players")

game.ReplicatedStorage.Report.OnServerEvent:Connect(function(player,reason)
	local FilteredString = game:GetService("Chat"):FilterStringForBroadcast(reason,player)
	local data = 
		{
			["content"] = "@here";
			["embeds"] = {{
				["title"] = player.Name.." Has sent a feedback"; 
				["description"] = reason; 
				["color"] = tonumber(0xADD8E6);
				["author"] = { 
					["name"] = player.Name; 
				};
				

			}}
		}
	
	local finaldata = HttpService:JSONEncode(data)
	HttpService:PostAsync(Webhook, finaldata)
end)
script.Parent.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.Report:FireServer(script.Parent.Parent.uitext.Text)
end)

Screenshot_2022-09-23_104510

add a line at the beginning of the OnServerEvent.

if reason:len() < 1 then return end -- can set minimum characters
1 Like