Hi devs. I have a little problem with my Marketplace. If per example i buy 200 xp, i'll get receive them normally, but as soon as i try to buy another thing all previous item execute again, why and how?
I dont know if you guys understand what I mean
If I buy xp/money
First purchase output:
439092562
Now if I buy money/xp
Secondly purchase output:
439092562 (x2)
439094412
I recieve xp and money id, why and how?
LocalScript Explorer
--< Services
local PlayerService = game:GetService('Players')
local MarketplaceService = game:GetService('MarketplaceService')
--< Events
for _, SurfaceGui in pairs(script.Parent:GetChildren()) do
if SurfaceGui:IsA('SurfaceGui') then
for _, ImageLabel in pairs(SurfaceGui.Shop:GetChildren()) do
ImageLabel.Button.MouseButton1Click:Connect(function()
MarketplaceService:PromptProductPurchase(PlayerService.LocalPlayer, ImageLabel.Name)
end)
end
end
end
Script
local PlayerService = game:GetService('Players')
MarketplaceService.ProcessReceipt = function(ReveipInfo)
local Player = PlayerService:GetPlayerByUserId(ReveipInfo.PlayerId)
local ProductId = ReveipInfo.ProductId
if ProductId == 439094412 then -- +325 money
DataManager:ChangeStat(Player, 350, 'Money', true)
print(ReveipInfo.ProductId)
elseif ProductId == 439103355 then -- +550 money
DataManager:ChangeStat(Player, 550, 'Money', true)
print(ReveipInfo.ProductId)
elseif ProductId == 439103573 then -- +875 money
DataManager:ChangeStat(Player, 875, 'Money', true)
print(ReveipInfo.ProductId)
elseif ProductId == 439104104 then -- +1,200 money
DataManager:ChangeStat(Player, 1200, 'Money', true)
print(ReveipInfo.ProductId)
elseif ProductId == 439092562 then -- +200 exp
DataManager:ChangeStat(Player, 200, 'Experience', true)
print(ReveipInfo.ProductId)
elseif ProductId == 439092841 then -- +400 exp
DataManager:ChangeStat(Player, 400, 'Experience', true)
print(ReveipInfo.ProductId)
elseif ProductId == 439093127 then -- +800 exp
DataManager:ChangeStat(Player, 800, 'Experience', true)
print(ReveipInfo.ProductId)
elseif ProductId == 439094114 then -- +1,600 exp
DataManager:ChangeStat(Player, 1600, 'Experience', true)
print(ReveipInfo.ProductId)
end
end

1 comment
Can you please clarify your question?