Trying to make a system where when a player fires a taser it sends a webhook to discord. When I run it nothing happens.
local Tool = script.Parent
local url = "https://discordapp.com/api/webhooks/"
local http = game:GetService("HttpService")
if Tool.Deployed.Value == true then
local data = {
['embeds'] = {{
['title'] = "Taser Fired",
['description'] = plr.Name .. " Has Fired His Taser."
}}
}
local finaldata = http:JSONEncode(data)
http:PostAsync(url, finaldata)
end
You only checked the Deployed bool value once, which then the check stops, and that code will never run, what you want to do is to instead connect it to either the Activated event of the tool or the Changed property of the bool value.
Please note that over sending message to Discord through webhook can result in your discord account being banned.
Also, that is only one of the cases, I don’t know if it is related to client/server replication or something.
also that end must have a closure bracket ) end)
because it is wrapped in the :Connect() function and ) in the end is basically the closing bracket of connect.
PLEASE note that Discord webhooks should not be used as a logging service. You risk getting both your account and server banned, and, in a worst-case scenario, end up getting the Roblox user-agent blacklisted by Discord AGAIN (this has happed a few years ago as a result of API abuse originating from Roblox).
You should instead look into hosting your own logging service or use one such as Loggly. Don’t ruin it for the rest of us