THIS SCRIPT IN STARTER PLAYER SCRIPTS local script
local MarketPlaceService = game:GetService("MarketplaceService")
local gamePassID = 18759963
local function promptPurchase()
local player = game.Players.LocalPlayer
local haspass = false
local success, message = pcall(function()
haspass = MarketPlaceService:UserOwnsGamePassAsync(player.UserID, gamePassID)
end)
if haspass == true then
print("Player Aldready has the gamepass")
else
MarketPlaceService:PromptGamePassPurchase(player, gamePassID)
end
end
wait(5)
promptPurchase()
this in serverscriptservice
local MarketPlaceService = game:GetService("MarketplaceService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local sword = ReplicatedStorage:WaitForChild("ClassicSword")
local gamePassID = 18759963
MarketPlaceService.PromptGamePassPurchaseFinished:Connect(function(player, purchasePassID, purchaseSuccess)
if purchaseSuccess == true and purchasePassID == gamePassID then
print(player.Name.. " purchased the sword gamepass")
sword.Parent = player.Character
end
end)
this also in server script service but in another script
local MarketPlaceService = game:GetService("MarketplaceService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local sword = ReplicatedStorage:WaitForChild("ClassicSword")
local gamePassID = 18759963
game.Players.PlayerAdded:Connect(function(player)
wait(5)
local char = game.Workspace:FindFirstChild(player.Name)
local haspass = false
local success, message = pcall(function()
haspass = MarketPlaceService:UserOwnsGamePassAsync(player.UserID, gamePassID)
end)
if haspass == true then
print("Player has sword gamepass")
sword.Parent = char
end
end)

2 comments
did it work?
btw, get rid of that script in start player scripts. Its useless