Hello.
Problem
You used LocalPlayer
in a ServerScript, which doesn't work because a ServerScript doesn't run on the client. Instead, it runs on a physical server.
Solution
Use the "plr" variable you made instead of LocalPlayer
Fixed Script:
01 | local MarketplaceService = game:GetService( "MarketplaceService" ) |
02 | local plrs = game:GetService( "Players" ) |
05 | local function processReceipt(recieptInfo) |
07 | local plr = plrs:GetPlayerByUserId(recieptInfo.PlayerId) |
09 | return Enum.ProductPurchaseDecision.NotProcessedYet |
14 | plr.Gems.Value = plr.Gems.Value + 100 |
18 | return Enum.ProductPurchaseDecision.PurchaseGranted |
22 | MarketplaceService.ProcessReceipt = processReceipt |
Please accept this answer if it helped. There's been a bug for new users that you have to go into incognito mode to accept an answer.