Hello, i am creating a donation GUI and i am running into some confusion on how i can get it to work in my favor. This is my first time using MarketPlaceService and i was wondering if i was doing this right
Heres my current code
--Client
local frame = script.Parent
local smallButton = frame["Small Donation"]
local mediumButton = frame["Medium Donation"]
local largeButton = frame["Large Donation"]
local event = game.ReplicatedStorage.Event
local CD = false
local MPS = game:GetService("MarketplaceService")
local IDs = {
smallDonationID = 1279686382
}
local plr = game.Players.LocalPlayer
smallButton.Activated:Connect(function(i, c)
if CD == false then
CD = true
MPS:PromptPurchase(plr, IDs.smallDonationID)
task.wait(5)
CD = false
end
end)
--Server
local MPS = game:GetService("MarketplaceService")
local IDs = {
smallDonationID = 1279686382
}
function processReciept(recieptInfo)
local plr = game.Players:GetPlayerByUserId(recieptInfo.PlayerId)
if not plr then
-----------
--player probably left the game, make sure they get prompted once they rejoin
return Enum.ProductPurchaseDecision.NotProcessedYet
else
print(plr.Name)
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
MPS.ProcessReceipt = processReciept
I followed the API doccumentation, and its not really working the way i intended it to work. (The output isnt printing)
I also have a few questions
- Is there a way i can use the same function to work with different dev products without having to write in different scripts?
- When i try out the dev product in game, it doesnt show the correct product (even tho i have the right ID), i assume its because ive only tested it in studio but i was wondering if this happened to other people as well.
My goal is to create a donation button, i might be overcomplicating things but im unsure. Help would greatly be appriciated, thank you for your time