How do I make roblox send data in httpsservice?

Hello developers,

I made a moderation-call system for my game, in case of any trollers,spammers and hackers.

local payload = httpsservice:JSONEncode({
                content = plr.Name.." is asking a mod to join their server in game!",
                username = "Game server"
            })
            local payload2 = httpsservice:JSONEncode({
                content = "Reason for mod-call: "..secondinfo;
                username = "Game server"
            })
            
            game.ReplicatedStorage.ModeratorCall:FireClient(player,number)
            number = number + 1
            wait(2)
            httpsservice:PostAsync(webhook,payload)
            httpsservice:PostAsync(webhook,payload2)
end)

Now I want to ping someone in discord, like (@Admins) someone is calling a mod.I am not able to ping them, if i send data like “plr is calling mod @admins” its just typing the text there
I want it to ping the role, any way to do this ping?

Maybe you can use a widget’d discord bot linked to your game for it

how do you do that? and what is a widget of discord

I would suggest you to take a look at this

it is exactly wait I did but my script has an error, it says https 400 bad request when I type allow mentions in JSEncond()

Personnaly i did it and it gaves me no error, check it again and see if you did a mistake with Upper or Lower cases

check it the script

            local payload = httpsservice:JSONEncode({
                content = plr.Name.." is asking an admin to join their server in game! <@Administrator> ",
                username = "Game server",
                allowed_mentions = true
            })

Does your game accept https request? On game settings

Yes it does and when I add allowed_mentions it does not work.If I remove allowed_mentions it works but I need to mention admins in this message

What does allowed_mentions? Show us a bit more of your code please

the full script check the else if script down, that is not working

local httpsservice = game:GetService("HttpService")
local number = 1
local webhook = "blah blah"


game.Players.PlayerAdded:Connect(function(plr)
    plr.Chatted:Connect(function(msg)
        local player = plr
        local message = msg
        local spiltedmessage = message:split(" ")
        if string.lower(spiltedmessage[1]) == "!mod" then
            local secondinfo = nil
            wait(0.5)
            if string.lower(spiltedmessage[2]) == "troller" or "hacker" or "spammer" or "bully" then
                secondinfo = spiltedmessage[2]
            else
                secondinfo = "No reason mentioned"
            end
            
            -- Sending message
            local payload = httpsservice:JSONEncode({
                content = plr.Name.." is asking a mod to join their server in game!",
                username = "Game server"
            })
            local payload2 = httpsservice:JSONEncode({
                content = "Reason for mod-call: "..secondinfo;
                username = "Game server"
            })
            
            game.ReplicatedStorage.ModeratorCall:FireClient(player,number)
            number = number + 1
            wait(2)
            httpsservice:PostAsync(webhook,payload)
            httpsservice:PostAsync(webhook,payload2)
        elseif string.lower(spiltedmessage[1]) == "!admin" then
            local secondinfo = plr.Name.." is calling an admin+ to join."
            wait(0.5)
            -- Sending message
            local payload = httpsservice:JSONEncode({
                content = plr.Name.." is asking an admin to join their server in game! <@Administrator> ",
                username = "Game server",
                allowed_mentions = true
            })
            local payload2 = httpsservice:JSONEncode({
                content = "Reason for mod-call: "..secondinfo;
                username = "Game server"
            })

            game.ReplicatedStorage.ModeratorCall:FireClient(player,number)
            number = number + 1
            wait(2)
            httpsservice:PostAsync(webhook,payload)
            httpsservice:PostAsync(webhook,payload2)
        end
    end)
end)

Weird thing, but i tried my best. Sorry to not be able to help you more, i will let someone more experienced trying to help you

Remove the webhook from the code! Other people can spam your webhook.
(From your post)

Ok done I removed the web hook from the code

If you want to ping a role, you should do
<@roleId>

The webhook is working? If it’s not you may have any error, if so, what does it print to console?

ohhhhhhhhh sorry I did not know, how to get role ID?

It prints HTTPS 400 Bad request if I add allow to ping

These are the steps to get the ID

  1. Mention the role in Discord
  2. Right click on the role
  3. Then on bottom click “Copy ID”

I cannot right click on the role