Issue for interacting with an mps.ProcessReceipt function

Problem : Hello, I am having trouble applying an action when a player makes a donation. An IntValue is called Donator and is located in the player but I can’t manage to interact with this script. I tried plr.Donator.Value = 1
But it does not work. I also tried to make a FireClient but it does not work either to interact with the value in a local script but it doesn’t work either. Thanks

mps.ProcessReceipt = function(Player)		
	print("Here i tried : Player.Donator.Value = 1")
	print("I also tried : Game.ReplicatedStorage.DonationOK:FireClient(Player)")
	local amount = mps:GetProductInfo(Player.ProductId, Enum.InfoType.Product).PriceInRobux

	local success, err = pcall(function()
		local totalDonated = ods:GetAsync(Player.PlayerId) or 0
		ods:SetAsync(Player.PlayerId, totalDonated + amount)
	end)
	return success and Enum.ProductPurchaseDecision.PurchaseGranted or Enum.ProductPurchaseDecision.NotProcessedYet
end

Hi anyone can help me to understand why theses lines don’t work in a mps.ProcessReceipt function ? Because they work in a classic script … ?

Do you have any console errors?

This is a bit unrelated to the problem, but have you heard of comments, they are great.

--hello
--i can type whatever i want

--[[
and i can type alot
of
lines
of it if you want




or put a few spaces
im telling you this because of those
print
statements
at the start of
]]
--your function

Problem is fixed i just add

local Player1 = game:GetService('Players').PlayerAdded:Wait()

in the start of the script

1 Like