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

My Gamepass Script is not 100% correct, it doesnt authorize every time?

Asked by 6 years ago
Edited 6 years ago

By not efficient, I mean that it doesn't fire to the client enough and sometimes doesn't fire to the client at all! Help!?

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

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

while wait(1) do
    for _,plr in ipairs(game.Players:GetPlayers()) do
        local success, message = pcall(function() isAuthenticatedforBlowgun(plr) end)
        if success and isAuthenticatedforBlowgun(plr) == true then
            game.ReplicatedStorage.GamepassEvent:FireClient(plr, "Blowgun")
        end
    end
    for _,plr in ipairs(game.Players:GetPlayers()) do
        local success, message = pcall(function() isAuthenticatedforSlots(plr) end)
        if success and isAuthenticatedforSlots(plr) == true then
            game.ReplicatedStorage.GamepassEvent:FireClient(plr,"4Slots")
        end
    end
end

1 answer

Log in to vote
1
Answered by
Asceylos 562 Moderation Voter
6 years ago
Edited 6 years ago

PlayerOwnsAsset does not work for gamepasses anymore. Instead use:

game:GetService("GamePassService"):PlayerHasPass(player,id)
0
Where's your source? I believe you're referring to Roblox disabling PlayerOwnsAsset as an alternative to BadgeService's UserHasBadge http://devforum.roblox.com/t/upcoming-changes-to-game-badges/35667 M39a9am3R 3210 — 6y
0
thanks @asceylos laughablehaha 494 — 6y
0
I was actually just informed of the change affecting game passes with a reference to the wiki. I kind of find it ridiculous Roblox is forcing its users to use a method that would cache the result. In this way you're forced to go to another server to use the gamepass. M39a9am3R 3210 — 6y
Ad

Answer this question