Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why wont my Developers product give the player the money they bought?

So, I've been working on this thing. and for some reason, when I buy it, it doesnt give the player the currency they are owed? Help pls ;-;

Script 1(localscript in button)

local MarketPlace = game:GetService("MarketplaceService")
local players = game:GetService("Players")

local ProductId = 1082680116
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
	wait(1)
	MarketPlace:PromptProductPurchase(player, ProductId)
end)

Script 2(script in serverscriptservice)

local MarketPlace = game:GetService("MarketplaceService")
local players = game:GetService("Players")
local ProductId = (TheProductID)

local function proccessReciept(receiptInfo)
	
	local player = players:GetPlayerByUserId(receiptInfo.PlayerId)
	if not player then
		--Player probably left
		--if they come back, the callback with begin again
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
	if player then
		player:WaitForChild('leaderstats'):WaitForChild('RunSpeed').Value = player.leaderstats.RunSpeed.Value +80
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
	
end

Thers nothing in output either.

3 comments

0

Does your processReceipt function run in the first place? Where did you assign it to the ProcessReceipt function callback in MarketplaceService?

0

it says "Attempt to index nil with 'PlayerId' "?

0

And, i just added that (How did i forget it?? XD)

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.