rojo/.cursor/rules/roblox/reference/engine/classes/GamePassService.yaml
2026-02-02 12:08:47 -06:00

104 lines
3.4 KiB
YAML

# This file is automatically generated. Please don't edit it manually.
# To submit a bug report on the content, see
# https://devforum.roblox.com/c/bug-reports/documentation-issues/72
name: GamePassService
type: class
memory_category: Instances
summary: |
A service associated with the legacy game pass system. Use
`Class.MarketplaceService` for all new work.
description: |
The GamePassService is a service that supports legacy game passes using _Asset
IDs_. `Class.MarketplaceService` should be used for all new game passes.
For more information about game passes, please see
[Game Passes](../../../production/monetization/passes.md).
code_samples: []
inherits:
- Instance
descendants: []
tags:
- NotCreatable
- Service
deprecation_message: ''
properties: []
methods:
- name: GamePassService:PlayerHasPass
summary: |
Returns `true` if the `Class.Player` has the specified **legacy** game
pass. Does not work with new game passes.
description: |
This function will not work with new game passes; use
`Class.MarketplaceService:UserOwnsGamePassAsync()` instead.
This function returns `true` if the `Class.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](../../../production/monetization/passes.md) 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.
<table>
<thead>
<tr>
<td></td>
<td>Asset ID (Legacy)</td>
<td>Pass ID (Current)</td>
</tr>
</thead>
<tbody>
<tr>
<td>Verify Ownership</td>
<td><code>Class.GamePassService:PlayerHasPass()</code></td>
<td><code>Class.MarketplaceService:UserOwnsGamePassAsync()</code></td>
</tr>
<tr>
<td>Prompt a purchase</td>
<td><code>Class.MarketplaceService:PromptPurchase()</code></td>
<td><code>Class.MarketplaceService:PromptGamePassPurchase()</code></td>
</tr>
<tr>
<td>Prompted purchase finished</td>
<td><code>Class.MarketplaceService.PromptPurchaseFinished</code></td>
<td><code>Class.MarketplaceService.PromptGamePassPurchaseFinished</code></td>
</tr>
</tbody>
</table>
code_samples:
- GamePassService-PlayerHasPass1
parameters:
- name: player
type: Player
default:
summary: |
The `Class.Player` for which to check ownership.
- name: gamePassId
type: int64
default:
summary: |
The _Asset ID_ of the game pass. This is **not** the _Game Pass ID_
(see above).
returns:
- type: boolean
summary: |
Whether the `Class.Player` owns the game pass.
tags:
- Yields
- Deprecated
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- Monetization
events: []
callbacks: []