Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

PlayerOwnsAsset does not work for gamepasses anymore. Instead use:

game:GetService("GamePassService"):PlayerHasPass(player,id)

3 comments

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

0

thanks @asceylos

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.