function MessageEmbed:PostAsync()
table.insert(self.package.embeds, self.embed)
coroutine.wrap(function()
HttpService:PostAsync(self.webhook, HttpService:JSONEncode(self.package))
end)()
end
This spams multiple times. I did 2 times same time and it did 3 times instead?
In your case, I think using a coroutine is unnecessary. Your coroutine is spamming multiple times because it is a looping function (as far as I know). It does send just 2 or 3 times because Discord has a rate limiting, if you send too much requests it will stop accepting your requests and block your IP (in this case, the Roblox’s server IP).
Instead, call PostAsync inside a local variable. This will return a message, which will be a error string if a error occurred in the request. If you want to get more detailed errors and also send more detailed requests, try using HttpService:RequestAsync().
Example of using the HttpService.PostAsync():
function MessageEmbed:PostAsync()
table.insert(self.package.embeds, self.embed)
local response = HttpService:PostAsync(self.webhook, HttpService:JSONEncode(self.package))
print(response)
end
It’s still happening. I mad a print message. It prints 2 times and when use post async it prints 3 times. My head is hurting from this. I was using someone else discord module and might make my own at this point
Maybe the function is being called more than one time somewhere on your scripts. Try searching for it using Ctrl + Shift + F, this will search in all of the scripts in the game.