GamePass
Game pass library that caches game pass ownership results and watches for pass purchases.
This module fixes the caching issue with UserOwnsGamePassAsync by saving purchases made in the server. This allows the user to continue playing without having to re-join.
local hasPass = GamePass.has(player.UserId, 123456)
Install with wally by adding the following to your wally.toml
:
GamePass = "dig1t/gamepass@1.0.9"
Functions
has
GamePass.
has
(
gamePassId:
number
--
The game pass id to check.
) →
boolean
Checks if a player has a game pass.
local hasPass = GamePass.has(player.UserId, 123456)
prompt
GamePass.
prompt
(
gamePassId:
number
--
The game pass id.
) →
(
)
Prompts the player to purchase a game pass.
GamePass.prompt(player, 123456)
watch
GamePass.
watch
(
) →
(
)
Watches for game pass purchases. This allows the player to continue playing without having to re-join.
This is automatically called when using GamePass.onPurchase
.
onPurchase
Types
Triggers a callback when a player purchases a game pass.
This calls GamePass.watch
to start watching for game pass purchases.
To stop watching for game pass purchases, use GamePass.unwatch
.
GamePass.onPurchase(function(player: Player, gamePassId: number)
print(player.Name .. " purchased game pass " .. gamePassId)
end)
unwatch
GamePass.
unwatch
(
) →
(
)
Stops watching for game pass purchases.