Anti Webhook Spam

Why won’t this script work? I am trying to make it so my webhook can not be spammed with @everyone or @here on Discord.

As you may already know it is just a textbox with a send button. Upon pressing send it will send the message typed in the textbox to my webhook.

if script.Parent.Text == "@everyone" or "@here" then
	script.Parent.Text = "No"
end

Thank you!

Could you send the full script?

There are two seperate scripts but here:

  • Anti Spam:
if script.Parent.Text == "@everyone" or "@here" then
	script.Parent.Text = "No"
end
  • Webhook Sender:
hs = game:GetService("HttpService")
url = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"


local event1 = Instance.new("RemoteEvent")
event1.Name = "Feedback"
event1.Parent = game.Workspace

event1.OnServerEvent:connect(function(player, arguments)

local myTable = {}
myTable["content"] = arguments
myTable["username"] = player.Name
local myTableJSON = hs:JSONEncode(myTable)

hs = game:GetService("HttpService")
myTableJSON = hs:JSONEncode(myTable)


 hs:PostAsync(url, myTableJSON)
end)

What’s the exact thing you want it to do and whats this doing?

Want me to try make my own?

Kind of confusing this way lol

Nothing is calling the first scripts code. Try this:

local UI = script.Parent --Shorten things a bit
local bannedPhrases = {"@everyone", "@here"} --A table for all the banned phrases

UI.Changed:connect(function() --When the UI changes
	for _,v in pairs(bannedPhrases) do --Go through every item in the banned phrases table
		if string.find(UI.Text, v) then --If the UI's text contains that phrase
			UI.Text = "Invalid Phrase" --Change it
		end
	end
end)

Ultimately, you can anything you want on the line that changes the UI.Text, for example kicking the player. Just going off what you had for now

1 Like

If you make it local bannedPhrases = {“@”} it should work, however let it be known that it essentially makes it so that users can never use the @ symbol. Therefore users cannot type things such as:
“Meet me @ 2”

1 Like

There would also be an easier way to prevent it. If it’s a discord webhook, you could just send an embed with the content in it.

1 Like

It does send a webhook to Discord, thats why I temporarily banned the user when they submitted and filtered and “@” pings.