Hello! So recently i’ve stumbled upon a weird activity in my game. I created a webhook for any purchases made in my game, and today i’ve came upon one person buying alot of products
but, when i go into the pending page under my group, that person is nowhere to be found. the username shown, leads to an account that is fresh, and has no friends or any major activity.
Here’s a snippet of my code:
if SpongeCoinsProductsID[ID] then
local player = game.Players:GetPlayerByUserId(userid)
print("did it work")
local DevProductINFO = MPS:GetProductInfoAsync(ID, Enum.InfoType.Product)
local Data = {
content = "**"..player.Name.."** has bought "..DevProductINFO.Name.." Product **("..DevProductINFO.PriceInRobux.." Robux)**!"
}
local newData = HttpService:JSONEncode(Data)
pcall(function()
print("Webhook successful!")
HttpService:PostAsync(webhook, newData)
end)
player:WaitForChild("leaderstats"):FindFirstChild("SpongeCoins").Value += SpongeCoinsProductsID[ID]
game.ReplicatedStorage.Remotes.PurchaseRobux:FireClient(player)
game.ReplicatedStorage.Remotes.Notification:FireClient(player, "Thank you for your purchase! You have been given " ..SpongeCoinsProductsID[ID].. " Sponge Coins!", Color3.fromRGB(85, 255, 0):ToHex(), nil)
print("Purchase Successful")
And so on for other products, i have never gotten a thing like this, and i wanna know is this some type of exploit, or a bug in my code?
edit: scrap that, join the game yourself, and press whatever leads to the dev product purchase a few times, see if that triggers the webhook
if so you aren’t verifying that the product was actually purchased
MPS.PromptProductPurchaseFinished:Connect(function(userid, ID, wasPurchased)
if wasPurchased == true then
if SpongeCoinsProductsID[ID] then
local player = game.Players:GetPlayerByUserId(userid)
print("did it work")
local DevProductINFO = MPS:GetProductInfoAsync(ID, Enum.InfoType.Product)
local Data = {
content = "**"..player.Name.."** has bought "..DevProductINFO.Name.." Product **("..DevProductINFO.PriceInRobux.." Robux)**!"
}
local newData = HttpService:JSONEncode(Data)
pcall(function()
print("Webhook successful!")
HttpService:PostAsync(webhook, newData)
end)
player:WaitForChild("leaderstats"):FindFirstChild("SpongeCoins").Value += SpongeCoinsProductsID[ID]
game.ReplicatedStorage.Remotes.PurchaseRobux:FireClient(player)
game.ReplicatedStorage.Remotes.Notification:FireClient(player, "Thank you for your purchase! You have been given " ..SpongeCoinsProductsID[ID].. " Sponge Coins!", Color3.fromRGB(85, 255, 0):ToHex(), nil)
print("Purchase Successful")
I tried pressing the purchase button and canceling the purchase prompt, and it successfully cancells the transaction and doesn’t give anything when it would when you bought it
Roblox highly advises not using PromptProductPurchaseFinished for handling purchase results on the documentation. This event is also client-sided meaning someone can fire it and act like they purchased the item. Use ProcessReceipt
One thing, ProcessReceipt is only for developer products, and for gamepasses, is this safe?
MPS.PromptGamePassPurchaseFinished:Connect(function(plr, ID, wasPurchased)
if wasPurchased == true then
if ID == 1693655701 then
local GamepassINFO = MPS:GetProductInfoAsync(ID, Enum.InfoType.GamePass)
local player = plr --game.Players:GetPlayerByUserId(plr.PlayerId)
local Data = {
content = "**"..plr.Name.."** has bought "..GamepassINFO.Name.." Gamepass **("..GamepassINFO.PriceInRobux.." Robux)**!"
}
local newData = HttpService:JSONEncode(Data)
pcall(function()
print("Webhook successful!")
HttpService:PostAsync(webhook, newData)
end)
player:WaitForChild("VIPGamepassOwned").Value = true
player:WaitForChild("OwnedSkins"):FindFirstChild("VIPSponge").Value = true
player:WaitForChild("OwnedSkins"):FindFirstChild("VIPSquidward").Value = true
game.ReplicatedStorage.Remotes.PurchaseRobux:FireClient(player)
game.ReplicatedStorage.Remotes.Notification:FireClient(player, "Thank you for your purchase! You have been granted all VIP perks!", Color3.fromRGB(85, 255, 0):ToHex(), nil)
print("Purchase Successful!")
end
end)
Also, im convinced that this was an exploiter since this happened again today, for a different person. This time our anti cheat detected them trying to get unobtainable skins, and exploiting jump power. Which means they probably completed the transactions on client, and due to the funciton being inconvinient, it gave it to them.
The code snippet you provided looks fine, you can use PromptGamePassPurchaseFinished to process gamepass purchases.
Make sure you are checking and confirming purchases on the server (if you need to check on the client, make sure you do so on the server too), so exploiters cannot bypass your checks.