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

Unsure of how to use multiple product ids to fire a remote event. Any solutions?

local market = game:GetService("MarketplaceService")
local gamepass = 1185550709
local gamepass2 = 1185547854
local gamepass3 = 1185548489
local gamepass4 = 1185551014
local gamepass5 = 1185549327
market.ProcessReceipt = function(ReciptInfo)
	if ReciptInfo.ProductId == gamepass..gamepass2..gamepass3..gamepass4..gamepass5 then
		local player = game.Players:GetPlayerByUserId(ReciptInfo.PlayerId)
		game.ReplicatedStorage.GUI:FireAllClients(player)
		wait(5)
		print("fire")
		local nuke = game.ReplicatedStorage:WaitForChild("Nuke"):Clone()
		nuke.Parent = workspace
		wait(20)
		nuke:Destroy()
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
end

It is a script in replicatedstorage

1 answer

Two fullstops .. are used to concantenate/join strings together. Like so:

print("2".."2") -- prints 22
print(gamepass..gamepass2..gamepass3..gamepass4..gamepass5) -- prints 11855507091185547854118554848911855510141185549327

You could use an or operator:

 if ReceiptInfo.ProductId == gamepass or  ReceiptInfo.ProductId == gamepass2 or ReceiptInfo.ProductId == gamepass3 or ReceiptInfo.ProductId == gamepass4 or ReceiptInfo.ProductId == gamepass5 then
	-- do stuff
end

Alternatively use a table, and the table.find() method:

table = {
 1185550709, 1185547854, 1185548489, 1185551014, 1185549327
}

if table.find(table, ReceiptInfo.ProductId) then
	-- do stuff
end

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