GamePassService

Show Deprecated
Not Creatable
Service

The GamePassService is a service that supports legacy game passes using Asset IDs. MarketplaceService should be used for all new game passes.

For more information about game passes, please see Game Passes.

Summary

Methods

Properties

Methods

PlayerHasPass

Yields
Deprecated

This function will not work with new game passes; use MarketplaceService:UserOwnsGamePassAsync() instead.

This function returns true if the Player has the specified legacy game pass. The result of this function may be cached, meaning it should not be relied on to give an up to date result.

See Passes for further information.

Legacy Game Passes

Historically, game passes on Roblox had an asset ID associated with them. Although such game passes still have an asset ID, they now also have a pass ID. All new game passes created only have a pass ID.

Whether you are using an Asset ID or a pass ID determines which API members you can use.

Parameters

player: Player

The Player for which to check ownership.

Default Value: ""
gamePassId: number

The Asset ID of the game pass. This is not the Game Pass ID (see above).

Default Value: ""

Returns

Whether the Player owns the game pass.

Code Samples

The below example will print whether or not the recently joined player owns the ' with the ID of 103728213.

GamePassService:PlayerHasPass

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

Events