Ive Tried To make This Work But Im Unsure Whats Wrong.
Script for serverscriptservice
local MPS = game:GetService("MarketplaceService") MPS.ProcessReceipt = function(receiptInfo) if receiptInfo.ProductId == 985697300 then local player = game.Players:GetPlayerByUserId(receiptInfo.Playerid) player.leaderstats.Life.Value = player.leaderstats.Life.Value * 2 return Enum.ProductPurchaseDecision.PurchaseGranted end end
Script For StarterGUI
MPS = game:GetService("MarketplaceService") id = 985697300 local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:connect(function() MPS:PromptProductPurchase(player, id) end)
Thanks For Your Help Whoever Answers me!
The error that you had was you had Playerid instead of PlayerId. The correct code should be
local MPS = game:GetService("MarketplaceService") MPS.ProcessReceipt = function(receiptInfo) if receiptInfo.ProductId == 985697300 then local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId) player.leaderstats.Life.Value = player.leaderstats.Life.Value * 2 return Enum.ProductPurchaseDecision.PurchaseGranted end end
I tested ingame and it multiplied a value in leaderstats. Let me know any errors!