Problem with Devolepers Product

Hello there, I’m doing Music system I now in part when I doing player can buy Developer Product and then music play
But I got problem So I checking the ProductId if is correct and is correct but in the script don’t do it what I want
I debugging it so it’s only print k so that means only purchase has been completed but nothing that I want
The script is in ServerScriptService
And is a normal script not local
Script here i

local Market = game:GetService("MarketplaceService")
Market.ProcessReceipt = function(receipt)
	print("k")
if receipt.ProductId == "967066031" then
	print("Huray")
	local Player = game.Players:GetPlayerByUserId(receipt.PlayerId)
	local Sound = Instance.new("Sound",game.ReplicatedStorage.Queue)
	print(Player.Name)
	Sound.SoundId = Player.PlayerGui.MusicBuy.Frame.Input.Text
	Sound.Name = "Song from "..Player.Name
	return Enum.ProductPurchaseDecision.PurchaseGranted
	end
end

Thank for read
Pixeluted

As defined by the Wiki:

https://developer.roblox.com/en-us/api-reference/callback/MarketplaceService/ProcessReceipt

receipt.ProductId is a number not string. Therefore receipt.ProductId == "967066031" will never be true.

You should be using receipt.ProductId == 967066031

2 Likes

Okay thank you it’s working Thank so much