Hello fellow developers, I’m getting an error whilst testing my Roblox-to-Discord function in the Roblox Player. The weird part is when I do it in Roblox Studio it works perfectly fine. Here’s my code, the script works perfectly it’s just the Roblox-to-Discord that’s not working.
game.Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(message)
if string.find(message, "!warn") then
if Player:GetRankInGroup(12556758) >= 8 then
local command = {}
for word in string.gmatch(message, "%S+") do
table.insert(command, word)
end
local player = command[2]
local reason = table.concat(command, " ", 3, #command)
local Webhook =
local HttpService = game:GetService("HttpService")
local WarnGui = script.WarnGui:Clone()
WarnGui.Parent = game.Players:FindFirstChild(player).PlayerGui
WarnGui.WarnFrame.Description.Text = "You've been warned by "..Player.Name.." because "..reason
WarnGui.WarnFrame:TweenPosition(UDim2.new(0.322, 0,0.306, 0), "In", "Quint")
local discordMessage = {
['embeds'] = {{
['title'] = Player.Name.." warned "..player,
['description'] = reason,
['color'] = 16744576
}}
}
discordMessage = HttpService:JSONEncode(discordMessage)
HttpService:PostAsync(Webhook, discordMessage)
end
end
end)
end)
Here’s what happens when I do it in Roblox Studio, the messaging system works fine.
Here’s what happens when I do it in Roblox Player, the messaging system doesn’t work.