Hey everyone! I’m trying to make it so when someone buys one of the games’ devproducts, it would send a message to the webhook.
Though, it is not currently sending the message to the webhook.
Here’s my script, if that’s helpful:
local webhookLink = "WEBHOOKLINK"
local MarketplaceService = game:GetService("MarketplaceService")
MarketplaceService.PromptPurchaseFinished:Connect(function(player, assetId, isPurchased)
if isPurchased then
local Asset = game:GetService("MarketplaceService"):GetProductInfo(assetId)
local http = game:GetService("HttpService")
local data =
{
["embeds"] = {{
["title"] = "New Donation",
["description"] = "**"..player.Name.."** just donated `"..Asset.PriceInRobux.."`!",
["thumbnail"] = {
["url"] = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&userId=" .. player.UserId,
},
["type"] = "rich",
["color"] = 2489161
}}
}
data = http:JSONEncode(data)
http:PostAsync(webhookLink, data)
else
end
end)
I have tried this in a LocalScript in StarterPlayerScripts and a script in ServerScriptService.
The color is valid I believe. I used an embed vizualiser. I guess Lua doesn’t support those color codes than just these specific ones. I will give that a try.
The color code they said wasn’t a HEX code, I now can’t remember the name of it… but it should also work on webhooks. (I haven’t tried the modifications btw.) HEX codes are 6 characters.
GetProductInfo should be passed an infotype, unless its an Asset. I believe your product is either a gamepass or devproduct, so you need to specify that with Enum.InfoType.Product or Enum.InfoType.GamePass.
Pretty sure the issue lies with the marketplace service code. I am pretty sure prompt purchase is for the purchase of roblox gear in your game. However if you are trying to log dev products you will need to use MarketplaceService/ProcessReceiptMarketplaceService | Documentation - Roblox Creator Hub