I'm trying to make a script that changes a bool value inside of a player when they purchase a gamepass. However, when one player purchases the gamepass, everyones bool value changes. I think it is because of the way I defined the player however I am unsure.

Any help appreciated, thanks

(normal script inside of sererscriptservice)

mps = game:GetService("MarketplaceService")
local gamepassid = 9310467
MarketplaceService = game:GetService("MarketplaceService")

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)

            if mps:UserOwnsGamePassAsync(player.UserId, gamepassid) the     
                    player.leaderstats.WorldFolder.World2.Value = true 


end

        MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player,purchasePassID, purchaseSuccess)
                if purchaseSuccess == true and  purchasePassID == gamepassid then 

                        player.leaderstats.WorldFolder.World2.Value = true 
                end
            end)


end)
end)

(sorry if you saw this yesterday, im reposting because i'm still stuck)

3 comments

0

Please do not duplicate questions.

1

change the player variable name in the PromptGamePassPurchaseFinished event then in your conditions check that the player from the event matched the player from the PlayerAdded event

0

Thanks mate