Script in ServerScriptService:
local gamepassIDs = {
[261692723] = script:WaitForChild(“Sword”,math.huge),
[261687552] = script:WaitForChild(“GravityCoil”,math.huge),
[261514808] = script:WaitForChild(“SpeedCoil”,math.huge),
[261690540] = script:WaitForChild(“FusionCoil”,math.huge),
[261695728] = script:WaitForChild(“tommy gun”,math.huge),
[261697421] = script:WaitForChild(“GrappleHook”,math.huge),
}
local mps = game:GetService(“MarketplaceService”)
game.Players.PlayerAdded:Connect(function(p)
for id, tool in pairs(gamepassIDs) do
if mps:UserOwnsGamePassAsync(p.UserId, id) then
tool:Clone().Parent = p.StarterGear
tool:Clone().Parent = p.Backpack
end
end
end)
mps.PromptGamePassPurchaseFinished:Connect(function(p, id, purchased)
if purchased and gamepassIDs[id] then
gamepassIDs[id]:Clone().Parent = p.StarterGear
gamepassIDs[id]:Clone().Parent = p.Backpack
end
end)
Script in GamepassShopFrame:
local gamepassIDs = {261514808, 261687552, 261690540, 261692763, 261695728, 261697421,}
local mps = game:GetService(“MarketplaceService”)
script.Parent.Visible = false
for i, id in pairs(gamepassIDs) do
local frame = script.GamepassFrame:Clone()
local info = mps:GetProductInfo(id, Enum.InfoType.GamePass)
frame.GamepassName.Text = info.Name
frame.GamepassDescription.Text = info.Description
frame.GamepassPrice.Text = info.PriceInRobux .. " Robux"
frame.GamepassIcon.Image = "rbxassetid://" .. info.IconImageAssetId
if not mps:UserOwnsGamePassAsync(game.Players.LocalPlayer.UserId, id) then
frame.BuyButton.MouseButton1Click:Connect(function()
mps:PromptGamePassPurchase(game.Players.LocalPlayer, id)
end)
else
frame.BuyButton.Text = "Bought"
frame.BuyButton.BackgroundColor3 = Color3.fromRGB(3, 75, 0)
frame.BuyButton.UIStroke1.Color = Color3.fromRGB(2, 58, 0)
frame.BuyButton.UIStroke2.Color = Color3.fromRGB(2, 58, 0)
end
frame.Parent = script.Parent.GamepassScroller
script.Parent.GamepassScroller.CanvasSize = UDim2.new(0, 0, 0, script.Parent.GamepassScroller.UIListLayout.AbsoluteContentSize.Y)
end