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

Whats the difference between GamePassService and MarketPlaceService?

I want to know whats the difference between GamePassService and MarketPlaceService. I want to make a gamepass enabled game but I do not know which to choose to use my my gamepass runner.

2 answers

✓ Accepted answer

GamePassService is used to check whether or not a player owns a gamepass.

Here's an example from the wiki. (http://wiki.roblox.com/index.php?title=API:Class/GamePassService/PlayerHasPass)

local id = 103728213
 
game.Players.PlayerAdded:connect(function(player)
    if Game:GetService("GamePassService"):PlayerHasPass(player, id) then 
        print(player.Name .. " has the game pass!")
    else
        print(player.Name .. " doesn't have the game pass...")
    end
end)

MarketPlaceService has a few more features, including the ability to prompt users to buy a gamepass. Here's another example from the wiki that prompts all new players to buy Beautiful Hair for Beautiful People. (http://wiki.roblox.com/index.php?title=API:Class/MarketplaceService/PromptPurchase)

game.Players.PlayerAdded:connect(function(player)
	game:GetService("MarketplaceService"):PromptPurchase(player, 16630147)
end)

If you want to check if a player own's a gamepass use GamePassService. If you would like to prompt a player to buy a gamepass, or handle any other ingame transactions use MarketPlaceService. You can find more uses for MarketPlaceService here: http://wiki.roblox.com/index.php?title=API:Class/MarketplaceService.

1 comment

0

I found that :PlayerOwnsAsset() works better. But, I do not care anyhow.

Use GamePassService, MarketPlaceService is responsible for in-game transactions. The GamePassService is used to check if a player has a gamepass.

1 comment

0

MarketplaceService works fine with :PlayerOwnsAsset

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