How can I make this SCRIPTING SYSTEM error to be FIXED!

Hello everyone
So I was making a gamepass shop that give you money, like a in game currency gamepass shop. It works everything right but when I buy the gamepass, the in game currency doesnt appear. I give you here all the material in relation to this problem:
Currency script on the ServerScriptService:

local replicatedStorage = game:GetService("ReplicatedStorage")
local DataStore = game:GetService("DataStoreService")
local ds = DataStore:GetDataStore("LeaderboardSave")
local RemoteEvent = game.ReplicatedStorage.RemoteEvent
game.Players.PlayerAdded:Connect(function(player)

	local leaderstats = Instance.new("Folder",player)
	leaderstats.Name = "leaderstats"
	
	local points = Instance.new("IntValue",leaderstats)
	points.Name = "Points"
	local HellCoins = Instance.new("IntValue", leaderstats)
	HellCoins.Name = "HellCoins"
	local HeavenCoins = Instance.new("IntValue", leaderstats)
	HeavenCoins.Name = "HeavenCoins"
	local AlienCoins = Instance.new("IntValue", leaderstats)
	AlienCoins.Name = "AlienCoins"
	
	local stats = ds:GetAsync(player.UserId)
	
	if stats ~= nil then
		points.Value = stats[1]
		HellCoins.Value = stats[2]
		HeavenCoins.Value = stats[3]
		AlienCoins.Value = stats[4]
	else
		points.Value = 0
		HellCoins.Value = 0
		HeavenCoins.Value = 0
		AlienCoins.Value = 0
	end
end)
	

game.Players.PlayerRemoving:Connect(function(player)
	   local save = {}
	table.insert(save, player.leaderstats.HellCoins.Value)
	table.insert(save, player.leaderstats.HeavenCoins.Value)
	table.insert(save, player.leaderstats.AlienCoins.Value)
	table.insert(save, player.leaderstats.Points.Value)
	ds:SetAsync(player.UserId, save)
end)

RemoteEvent.OnServerEvent:Connect(function(player, Value, Item) --
    player.leaderstats.Points.Value = player.leaderstats.Points.Value - Value
    game.ReplicatedStorage.Library[Item]:Clone().Parent = player:WaitForChild("Backpack")
end)

Script that define the most important things of the system on the ServerScriptService:

local MPS = game:GetService("MarketplaceService")

MPS.ProcessReceipt = function(receiptInfo)
	if receiptInfo.ProductId == "1022102502" then
		local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		player.leaderstats.HellCoins.Value = player.leaderstats.HellCoins.Value + 500
		return Enum.ProductPurchaseDecision.PurchaseGranted
    elseif receiptInfo.ProductId == "1022102764" then
		local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		player.leaderstats.HellCoins.Value = player.leaderstats.HellCoins.Value + 700
		return Enum.ProductPurchaseDecision.PurchaseGranted
    elseif receiptInfo.ProductId == "1022102923" then
		local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		player.leaderstats.HellCoins.Value = player.leaderstats.HellCoins.Value + 1000
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
end

Local Script on the BuyButton of the shop:

MPS = game:GetService("MarketplaceService")

id = 1022102502

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()

MPS:PromptProductPurchase(player, id)

end)

And I thing that is everything. I hope you can get the soltuion and thanks everyone for reading this post. It will really help me
Spideyalvaro999 :slight_smile:

it gives it to the player after onServerEvent, but i dont see FireServer anywhere.

So in wich script I should type that? and for that I should create a remote event right?

Yes make a remote event and make it fire in a localscript.

So i make a variable like for example
local RE = game.ReplicateStorage.RemoteEvent
and something like this:
script.Parent.MouseButton1Click:Connect(function()

MPS:PromptProductPurchase(player, id)
RemoteEvent:FireServer()
end)

if RE is the RemoveEvent then you would do RE:FireServer()

Yes my fault, but it would be well placed there or I should place it in other place?

Yes it should be in the buy button (LocalScript)

it didn’t work
I wrote this on the BuyButton:

MPS = game:GetService("MarketplaceService")

id = 1022102502

local RE = game.ReplicatedStorage.RobuxRemoteEvent.Hell500

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()

MPS:PromptProductPurchase(player, id)

RE:FireServer()

end)

This is a post that is on the devforums.

So what should I do? How can I pass the requiered arguments?

This is a post that is on the devforums.

So I shouldn’t remove the fire server line right? and how can I do with the part of the exploiters?

Try

RE:InvokeServer(player, id)

I write that on the local script?

This is a post that is on the devforums.

Yes replace the MPS and the fire server with that

local MPS = game:GetService("MarketplaceService")
local id = 1022102502
local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
    MPS:PromptProductPurchase(player, id)
end)

I have read the forum post but there are only basic ideas I previously knew. What you are talking about hackers and the requiered arguments doesn’t appear or I dont understant what you are talking about.

Thats the same script I had written. I dont know what you are pretending to say us