why is the gamepass not coming after you rejoin after buying?
Asked by
3 years ago Edited 3 years ago
THIS SCRIPT IN STARTER PLAYER SCRIPTS local script
01 | local MarketPlaceService = game:GetService( "MarketplaceService" ) |
03 | local gamePassID = 18759963 |
05 | local function promptPurchase() |
07 | local player = game.Players.LocalPlayer |
10 | local success, message = pcall ( function () |
11 | haspass = MarketPlaceService:UserOwnsGamePassAsync(player.UserID, gamePassID) |
14 | if haspass = = true then |
15 | print ( "Player Aldready has the gamepass" ) |
17 | MarketPlaceService:PromptGamePassPurchase(player, gamePassID) |
this in serverscriptservice
01 | local MarketPlaceService = game:GetService( "MarketplaceService" ) |
02 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
03 | local sword = ReplicatedStorage:WaitForChild( "ClassicSword" ) |
05 | local gamePassID = 18759963 |
07 | MarketPlaceService.PromptGamePassPurchaseFinished:Connect( function (player, purchasePassID, purchaseSuccess) |
09 | if purchaseSuccess = = true and purchasePassID = = gamePassID then |
10 | print (player.Name.. " purchased the sword gamepass" ) |
11 | sword.Parent = player.Character |
this also in server script service but in another script
01 | local MarketPlaceService = game:GetService( "MarketplaceService" ) |
02 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
03 | local sword = ReplicatedStorage:WaitForChild( "ClassicSword" ) |
05 | local gamePassID = 18759963 |
08 | game.Players.PlayerAdded:Connect( function (player) |
10 | local char = game.Workspace:FindFirstChild(player.Name) |
13 | local success, message = pcall ( function () |
14 | haspass = MarketPlaceService:UserOwnsGamePassAsync(player.UserID, gamePassID) |
17 | if haspass = = true then |
18 | print ( "Player has sword gamepass" ) |