local id = 74373689
local ToolNames = {"Duel Pistols"}
local Storage = game:GetService("ServerStorage")
script.Parent.ClickDetector.MouseClick:Connect(function(p)
if game.MarketplaceService:UserOwnsGamePassAsync(p.UserId, id) then
local Backpack = p:WaitForChild("Backpack")
local mps = game:GetService("MarketplaceService")
for i = 1, #ToolNames do
local Tool = Storage:FindFirstChild(ToolNames[i])
if Tool then
Tool:clone().Parent = Backpack
else
mps:PromptGamePassPurchase(p,id)
end
end
end
end)
this script is supposed to give the player a tool if they own the gamepass when they click the part and if the player does not own the gamepass it prompts a gamepass purchase
if your looking for the working script it is here:
local id = 13155292
local ToolNames = {"Duel Pistols"}
local Storage = game:GetService("ServerStorage")
script.Parent.ClickDetector.MouseClick:Connect(function(p)
if game.MarketplaceService:UserOwnsGamePassAsync(p.UserId, id) then
local Backpack = p:WaitForChild("Backpack")
--local mps = game:GetService("MarketplaceService")
for i = 1, #ToolNames do
local Tool = Storage:FindFirstChild(ToolNames[i])
if Tool then
Tool:clone().Parent = Backpack
--else
--mps:PromptGamePassPurchase(p,id)
end
end
else
local mps = game:GetService("MarketplaceService")
mps:PromptGamePassPurchase(p,id)
end
end)