How to make a gamepass automatically given to you

I want to make it so that my gamepass as soon as its bought, they the player is able to receive it, how would i do this?

what does the gamepass give the player, also its pretty simple after u run the script that allows the player to purchase the gamepass run the code that gives out gamepasses when a player joins

define marketplace service tho

MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, pass_id, was_purchased)
    if was_purchased == true then
          -- grant them gamepass permissions
    end
end)