The gamepass is supposed to give players a sword. The sword is given but when you die and respawn you don't have it. Here is the script I used on my purchase GUI (it works):
local MarketplaceService = game:GetService("MarketplaceService") local Players = game:GetService("Players")
local swordGamepassID = 14167811
game.Players.PlayerAdded:Connect(function(player)
local success, message = pcall(function() hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, swordGamepassID) end) if hasPass then print("player has the gamepass") local Sword = game.ReplicatedStorage.FireSword:Clone() Sword.Parent = player.Backpack end
end)
local function onPromptGamePassPurchaseFinished(player, purchasedPassID, purchaseSuccess)
if purchaseSuccess == true and purchasedPassID == swordGamepassID then print(player.Name .."purchased the game pass!") local Sword = game.ReplicatedStorage.FireSword:Clone() Sword.Parent = player.Backpack end
end
MarketplaceService.PromptGamePassPurchaseFinished:Connect(onPromptGamePassPurchaseFinished)
Here is the script I put in Server Script Service:
local MarketplaceService = game:GetService("MarketplaceService") local Players = game:GetService("Players")
local swordGamepassID = 14167811
game.Players.PlayerAdded:Connect(function(player)
local success, message = pcall(function() hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, swordGamepassID) end) if hasPass then print("player has the gamepass") local Sword = game.ReplicatedStorage.FireSword:Clone() Sword.Parent = player.Backpack end
end)
local function onPromptGamePassPurchaseFinished(player, purchasedPassID, purchaseSuccess)
if purchaseSuccess == true and purchasedPassID == swordGamepassID then print(player.Name .."purchased the game pass!") local Sword = game.ReplicatedStorage.FireSword:Clone() Sword.Parent = player.Backpack end
end
MarketplaceService.PromptGamePassPurchaseFinished:Connect(onPromptGamePassPurchaseFinished)
I put the sword inside RepStorage.
if you want the sword to stay there permenantly, instead of setting up a cloning on respawn system like the above answer suggests, simply clone the sword to the "StarterGear" object and the "Backpack".Roblox automatically clears the backpack and clones "StarterGear" tools to it on player respawn, instead of using:
Sword.Parent = player.Backpack
Use
Sword.Parent = player.StarterGear local Sword = Sword:Clone() Sword.Parent = player.Backpack
Above example will clone the sword to the StarterGear, and then re-clone the cloned sword to the backpack
Script is set up so that it runs only when the player joins the game for the first time. Use CharacterAdded to run a function whenever the player respawns.