Hello devs, I’m trying to code an inf storage gamepass
but it doesn’t work not even the gamepass prompt will show…
sorry if its messy
here’s the code:
local RS = game:GetService("ReplicatedStorage")
local bags = RS:WaitForChild("Bags")
local eventsFolder = RS:WaitForChild("events")
local player = game.Players.LocalPlayer
local infoFrame = script.Parent.infoFrame
local SelectedBag = script.Parent.SelectedBag
local MPS = game:GetService("MarketplaceService")
local INFINITEBAGGAMEPASS = 4998199713 -- Change to your gamepassId
script.Parent.SelectedBag.Changed:Connect(function(val)
if val == "InfiniteBag" then
infoFrame.itemPicture.Image = script.Parent.Items.ItemsContainer[val].Button.Image
infoFrame.BuyBtn.Text = "Buy"
infoFrame.itemRobuxAdvisory.Visible = true
infoFrame.itemName.Text = val
infoFrame.itemPrice.TextColor3 = Color3.fromRGB(0, 223, 0)
infoFrame.itemPrice.Text = "R$: "..bags[val].bagCost.Value
infoFrame.itemStorage.Text = "Storage: "..bags[val].bagStorage.Value
if player.Data.BackpackData.EquippedBag.Value == infoFrame.itemName.Text then
infoFrame.BuyBtn.Text = "Equipped"
elseif player.Data.BackpackData.OwnedBags:FindFirstChild(infoFrame.itemName.Text) then
infoFrame.BuyBtn.Text = "Equip"
else
infoFrame.BuyBtn.Text = "Buy"
end
else
infoFrame.itemPicture.Image = script.Parent.Items.ItemsContainer[val].Button.Image
infoFrame.BuyBtn.Text = "Buy"
infoFrame.itemRobuxAdvisory.Visible = false
infoFrame.itemName.Text = val
infoFrame.itemPrice.TextColor3 = Color3.fromRGB(255, 255, 0)
infoFrame.itemPrice.Text = "Coins 💰: "..bags[val].bagCost.Value
infoFrame.itemStorage.Text = "Storage: "..bags[val].bagStorage.Value
if player.Data.BackpackData.EquippedBag.Value == infoFrame.itemName.Text then
infoFrame.BuyBtn.Text = "Equipped"
elseif player.Data.BackpackData.OwnedBags:FindFirstChild(infoFrame.itemName.Text) then
infoFrame.BuyBtn.Text = "Equip"
else
infoFrame.BuyBtn.Text = "Buy"
end
end
end)
infoFrame.BuyBtn.MouseButton1Click:Connect(function()
if script.Parent.SelectedBag.Value ~= "" and not player.Data.BackpackData.OwnedBags:FindFirstChild(infoFrame.itemName.Text) and infoFrame.itemPrice.TextColor3 == Color3.fromRGB(255, 255, 0) then
local check = eventsFolder.buyBag:InvokeServer(SelectedBag.Value)
if check then
infoFrame.BuyBtn.Text = "Equipped"
else
infoFrame.BuyBtn.Text = "Can't Buy You Don't Have enough cash!"
wait(2)
infoFrame.BuyBtn.Text = "Buy"
end
print("Buying Bag")
elseif script.Parent.SelectedBag.Value ~= "" and player.Data.BackpackData.OwnedBags:FindFirstChild(infoFrame.itemName.Text) and player.Data.BackpackData.EquippedBag.Value ~= SelectedBag.Value then
print("Equiping Bag")
local equipCheck = eventsFolder.equipBag:InvokeServer(SelectedBag.Value)
if equipCheck then
infoFrame.BuyBtn.Text = "Equipped"
end
elseif script.Parent.SelectedBag.Value ~= "" and MPS:UserOwnsGamePassAsync(player.UserId, INFINITEBAGGAMEPASS) and player.Data.BackpackData.EquippedBag.Value ~= SelectedBag.Value then
print("Equiping Infinite Bag")
local infiniteequipCheck = eventsFolder.equipInfiniteBag:InvokeServer(SelectedBag.Value)
if infiniteequipCheck then
infoFrame.BuyBtn.Text = "Equipped"
end
end
end)