Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
xp5u 25
3 years ago
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

Log in to vote
0
Answered by 3 years ago

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
Ad

Answer this question