Table of Gamepasses

Nothing at all prints? No errors? At this point you gotta print if the OnPlayerAdded fires.

I retried it to see if there were any mistakes and tested it again and this printed.
Screen Shot 2022-08-04 at 22.15.11

print(hasPass, success, message)

So it works but also doesn’t work…

Ok I found the error, it should be player.UserId and not player.UserID

Script:

local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

local gamePassIDs = {
	money_multiplier = 69544154,
	infinite_backback = 69544266,
	autoclicker = 69545150
}

local function onPlayerAdded(player)
	local multiplierfolder = player:WaitForChild("mf")
	
    for gamePassName, gamePassID in pairs(gamePassIDs) do
        print(gamePassName, gamePassID)
        local hasPass = false
        local success, message = pcall(function()
		    hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamePassID)
	    end)
        print(hasPass, success, message)
        if hasPass then
            print("Has Gamepass:", gamePassID)
		    if gamePassName == "money_multiplier" then
                print("Has Money_Multiplier Gamepass")
			    local moneyMultiplier = multiplierfolder:WaitForChild("moneyMultiplier")
			    moneyMultiplier.Value = moneyMultiplier.Value*2
		    end
	    end	
    end
end

Players.PlayerAdded:Connect(onPlayerAdded)
1 Like

It works! You really are the best. Thank you so much for all of your time and help.

Side note: funny how such a very small spelling mistake can wreck an entire piece of code…

1 Like