How do I make a gear gamepass

I have tried finding tutorials for how to do it but they all only give the gear when they join the game so if they die the gear is gone and if they buy the gamepass inside of the game they have to rejoin

2 Likes

They probably forgot to put the gear in the StarterGear as well oof, I’ll explain:

So making a Gear Gamepass, should be fairly simple but first you should hopefully know these by now:

  • MarketPlaceService

  • PromptGamePassPurchase

  • PromptGamePassPurchaseFinished

Now, let’s get started!

It should be fairly simple to create the gamepass, first we can go ahead & define the Player using game.Players.PlayerAdded in a Script, & our MarketPlaceService so inside our code here:

local MarketService = game:GetService("MarketPlaceService")
local GamepassID = 00000 --Make sure to change that with your ID

game.Players.PlayerAdded:Connect(function(Player)

end)

We have our variables & event defined, next we’ll go ahead and prompt the Gamepass we’re gonna use to purchase:

local MarketService = game:GetService("MarketPlaceService")
local GamepassID = 00000 --Make sure to change that with your ID

game.Players.PlayerAdded:Connect(function(Player)
    MarketService:PromptGamePassPurchase(Player, GamepassID)
end)

PromptGamePassPurchase has 2 parameters:

  • Parameter 1: The player that fired the function

  • Paramater 2: The ID of the gamepass

Now what we’ll do, is create another event for the Gamepass waiting to be purchased using PromptGamePassPurchaseFinished, and it’ll give the tools when the game detects a successful purchase!

local MarketService = game:GetService("MarketPlaceService")
local GamepassID = 00000 --Make sure to change that with your ID

game.Players.PlayerAdded:Connect(function(Player)
    MarketService:PromptGamePassPurchase(Player, GamepassID)
end)

MarketService.PromptGamePassPurchaseFinished:Connect(function(Player, GamepassID, PurchaseSuccess)
    if PurchaseSuccess == true then
        local Tool = game.ReplicatedStorage.Tool:Clone()
        Tool.Parent = Player.Backpack
        local Tool = game.ReplicatedStorage.Tool:Clone()
        Tool.Parent = Player.StarterGear
    end
end)

PromptGamePassPurchaseFinished has 3 parameters this time:

  • The Player who triggered it

  • The Gamepass ID

  • The check if a Player has bought a gamepass or not (Aka true/false)

And that should be it!

But I’m assuming the main reason why they didn’t get the tool again upon respawn is cause they only parented it to the Player’s Backpack

4 Likes