-
What do you want to achieve? I want to create a command system in which when you write !warn [playername] [reason] it’ll send that to Discord and you’ll be able to access it from there.
-
What is the issue? I already have the Roblox-to-Discord working, just wondering how I would display the reason, when a admin sends the reason, it’ll be more than 1 word, so I’m trying to see how to add those words without needing the call them 1 by 1. Anyways, here’s my script.
game.Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(message)
if string.find(message, "!warn") then
local command = {}
for word in string.gmatch(message, "%S+") do
table.insert(command, word)
end
local player = command[2]
local reason = command[3] -- What I want to change; not sure what do change it to though.
local Webhook = "not shown for obvious reasons :)"
local HttpService = game:GetService("HttpService")
local discordMessage = {
['embeds'] = {{
['title'] = Player.Name.." warned "..player,
['description'] = reason,
['color'] = 16744576
}}
}
local finaldiscordMessage = HttpService:JSONEncode(discordMessage)
HttpService:PostAsync(Webhook, finaldiscordMessage)
end
end)
end)
If anyone knows how to achieve what I’m trying to do please let me know.