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

Why isn't my PromptPurchaseFinished event firing when i purchase the product?

Localscript:

--Variables--
local Button = workspace.Shop.Buy_fifty_Coins.Purchase_Button.SurfaceGui.Button
local id = 933602329 
local MP = game:GetService("MarketplaceService")
local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait(0.01)
--<--->--
Button.Activated:Connect(function()
	MP:PromptProductPurchase(player,id)
end)

server script:

local MP = game:GetService("MarketplaceService")
local DTS = game:GetService("DataStoreService")
local Savevalues = DTS:GetDataStore("SaveValues")
local Id = 933602329

MP.PromptPurchaseFinished:Connect(function(player, Id, isPurchased)
	local Credits = player:WaitForChild("Currency").Credits
	print("Runned")
	if isPurchased then
		print("working")
		Credits.Value = Credits.Value +50
		
local Fol = player:WaitForChild("Currency")

local tosave = {}

for i,v in pairs(Fol:GetChildren())do
tosave[#tosave + 1] = v.Value
end
pcall(function()
Savevalues:SetAsync(player.UserId,tosave)
		
		print(player.Name.." Bought fifty Credits!")
end)
	end
	end)

2 comments

0

what is the script suppose to do?

0

what is the script suppose to do?

1 answer

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