Hello, I’m trying to find the matching GamePassId and string in my table.
local gamePasses = {
["VIP"] = 222142153
}
local function onGamePassPurchased(gamePassId: number)
print(table.find(gamePasses, gamePassId))
--Also find out what the name of that GamePass would be from the table?
end
game:GetService("ReplicatedStorage"):WaitForChild("Events"):WaitForChild("GamePassPurchased").OnClientEvent:Connect(onGamePassPurchased)
Flip the table around and you’ll be able to index the table to get the string.
local gamePasses = {
[222142153] = "VIP"
}
local function onGamePassPurchased(gamePassId: number)
local name = gamePasses[gamePassId]
end
game:GetService("ReplicatedStorage"):WaitForChild("Events"):WaitForChild("GamePassPurchased").OnClientEvent:Connect(onGamePassPurchased)