I want to make a system that reads the bool values in the files and sends them to the discord.
but I’m getting HTTP 400 Bad request error, I searched for the reason and saw that discord could not print in table format, but I don’t know how to print bool values using \n.
local function CheckFolders(player,foldername)
if player ~= nil then
if foldername.Name == "Hoverboard" then
for number,obj in pairs(foldername:GetChildren()) do
HoverboardTable[#HoverboardTable + 1] = tostring(tostring(obj.Name).." = **"..tostring(obj.Value).."**")
end
return HoverboardTable
elseif foldername.Name == "PassList" then
for number,obj in pairs(foldername:GetChildren()) do
PassTable[#PassTable + 1] = tostring(obj.Name).." = **"..tostring(obj.Value).."**"
end
return PassTable
end
end
end
function webhookHandler:SendMessage(player,Type,message)
local passlist = player:WaitForChild("PassList")
local hoverlist = player:WaitForChild("Hoverboard")
local userId = player.UserId
local date = os.date("!*t")
local Data = {
["contents"] = "",
["embeds"] = {
{
["title"]= "Player information:",
["color"] = 36096,
["author"] = {
["name"]= player.Name.." joined the game!",
["url"] = "https://www.roblox.com/users/"..userId.."/profile",
["icon_url"] = "https://www.roblox.com/headshot-thumbnail/image?userId="..userId.."&width=420&height=420&format=png"
},
["fields"] = {
{
["name"] = "Level",
["value"] = Players[player.Name]:WaitForChild("NametagSaves").Level.Value,
["inline"] = true
},
{
["name"] = "Gamepass List",
["value"] = CheckFolders(player,passlist),
["inline"] = true
},
{
["name"] = "Hoverboard List",
["value"] = CheckFolders(player,hoverlist),
["inline"] = true
},
{
["name"] = "Radio List",
["value"] = "none",
["inline"] = true
}
},
["footer"] = {
["text"] = date.day.."/"..date.month.."/"..date.year,
}
}
}
}
if Type == "Join" then
Data = HttpService:JSONEncode(Data)
print(Data)
HttpService:PostAsync(URL, Data)
end
end
The full form after printing is like this:
{“contents”:"",“embeds”:[{“fields”:[{“value”:1940,“name”:“Level”,“inline”:true},{“value”:[[“HoverboardPass = true”,“RadioPass = true”,“VIPPass = true”,“HousePass = true”]],“name”:“Gamepass List”,“inline”:true},{“value”:[[“Cat = true”,“Tech = true”]],“name”:“Hoverboard List”,“inline”:true},{“value”:“none”,“name”:“Radio List”,“inline”:true}],“title”:“Player information:”,“footer”:{“text”:“28/5/2022”},“color”:36096,“author”:{“icon_url”:“https://www.roblox.com/headshot-thumbnail/image?userId=1677188092&width=420&height=420&format=png",“name”:"N3mes1s_Nyks joined the game!”,“url”:“https://www.roblox.com/users/1677188092/profile”}}]}
You can look it up yourself with json beautifier.
Here’s how it looks when converted to json:
The way it should actually be:
If you have any information on this subject, please do not hesitate to let me know. I’ll be sure to take an active look, thanks in advance for your help.