The script is related to a GUI Button, it opens up DevProduct Prompt and allows a purchase but dosent actually add the money.
local button = script.Parent local mpService = game:GetService('MarketplaceService') button.MouseButton1Down:connect(function() mpService:PromptProductPurchase(game.Players.LocalPlayer, 217674504 ) end) function mpService.ProcessReceipt(receiptInfo) local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId) if receiptInfo.ProductId == 217674504 then player.leaderstats.Shillings.Value = player.leaderstats.Shillings.Value + 100 return Enum.ProductPurchaseDecision.PurchaseGranted end end
Cheers for the Help
You can't use MarketplaceService on a LocalScript, or in a player since some weird things may happen. ProcessReceipt can only be used in one script, or else it will glitch out. It's like a bunch of players respawning and it keeps on triggering "ProcessReceipt" since it's in a GUI element.
So, you need to make it separate scripts, the button script on the button and the one that runs ProcessReceipt somewhere else, that will only make it run once.
So, here's a step by step process on how to fix it:
local button = script.Parent local mpService = game:GetService('MarketplaceService') button.MouseButton1Down:connect(function() mpService:PromptProductPurchase(game.Players.LocalPlayer, 217674504 ) end)
3 & 4: Insert a Script in "ServerScriptService" & Put this code in the Script:
local mpService = game:GetService('MarketplaceService') function mpService.ProcessReceipt(receiptInfo) local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId) if receiptInfo.ProductId == 217674504 then player.leaderstats.Shillings.Value = player.leaderstats.Shillings.Value + 100 return Enum.ProductPurchaseDecision.PurchaseGranted end end
And you're done! :)
This has been tested, and it works. DO NOT keep on duplicating the script in "ServerScriptService" to put more codes in, or else it will glitch.