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.

1 comment
Okay for some reason the script in the question isn't as i intended it. Hope you can still work it out tho...