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

Why This GamePass Script Not Running after added pcall()?

Asked by 7 years ago

After I added the pcall() modifications, it stopped working, and even before that it didn't work 100% of the time. Any errors you can spot?

function isAuthenticatedforBlowgun(player) -- checks to see if the player owns your pass
    return game:GetService("MarketplaceService"):PlayerOwnsAsset(player, 483225340)
end

function isAuthenticatedforSlots(player) -- checks to see if the player owns your pass
    return game:GetService("MarketplaceService"):PlayerOwnsAsset(player, 483221291)
end

while wait() do
    for _,plr in ipairs(game.Players:GetPlayers()) do
        local success, message = pcall(isAuthenticatedforBlowgun)
        if success then
            game.ReplicatedStorage.GamepassEvent:FireClient(plr, "Blowgun")
        end
    end
    for _,plr in ipairs(game.Players:GetPlayers()) do
        local success, message = pcall(isAuthenticatedforSlots)
        if success then
            game.ReplicatedStorage.GamepassEvent:FireClient(plr,"4Slots")
        elseif not success then
            print('slots gamepass not working..')
        end
    end
end

1 answer

Log in to vote
2
Answered by
cabbler 1942 Moderation Voter
7 years ago

isAuthenticatedforBlowgun(player) requires a player parameter, but you don't provide that parameter when you simply do pcall(isAuthenticatedforBlowgun).

Do this: pcall(function() isAuthenticatedforBlowgun(plr) end)

You probably don't need to use pcall anyway but whatever.

Ad

Answer this question