Return data issues

  1. What is the issue? Bad request 400
game.Players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(msg)
		if string.find(msg, ":log leaderboard") then
			local args = string.split(msg, " ")
			local data = {
				["avatar_url"] = (("http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&userId="..player.UserId)),
				["content"] = player.leaderstats,
				["username"] = player.Name .. " - (#" .. player.UserId .. ")"
			}
			data = http:JSONEncode(data)
			http:PostAsync("https://hooks.hyra.io/api/webhooks/885989691512463411/RVomSIkPCem9DfDseF9YGRfI6L1JFWizGYGtO_fQrlxi2nMoRQ3M8vtYy_XZsvQloyH6", data)
		end
	end)
end)

Yes I know discord doesn’t work with roblox I know it’s not the issues I got custom https I only need to know how to return the whole leaderstats data…

Are you asking how to tabularize every player’s leaderstats into a single table?

local players = game:GetService("Players")

local function tabularizeLeaderstats()
	local leaderstatsTable = {}
	for _, player in ipairs(players:GetPlayers()) do
		if player then
			local ls = player:FindFirstChild("leaderstats")
			if ls then
				local statsTable = {}
				for _, stat in ipairs(ls:GetChildren()) do
					statsTable[stat.Name] = stat.Value
				end
				leaderstatsTable[player.Name] = statsTable 
			end
		end
	end
	return leaderstatsTable
end
--format: {playerName = {stat1Name = stat1Value, etc.}}