Hi! I was creating a shop where players can buy items shown in their inventory section. Is there a way where I could make it prompt the player to purchase the chosen item, and have them unequip it when they cancel the purchase? Thanks!
Code:
local player = game.Players.LocalPlayer
local mps = game:GetService("MarketplaceService")
local inventory = player.Backpack
local gravityCoil = game:GetService("ReplicatedStorage"):FindFirstChild("GravityCoil"):Clone()
local gcid = 1051183559
local gravityCoilClaim = game:GetService("ReplicatedStorage"):FindFirstChild("GravityCoil")
local speedCoil = game:GetService("ReplicatedStorage"):FindFirstChild("SpeedCoil"):Clone()
local fusionCoil = game:GetService("ReplicatedStorage"):FindFirstChild("FusionCoil"):Clone()
local flyingCarpet = game:GetService("ReplicatedStorage"):FindFirstChild("FlyingCarpet"):Clone()
local grappleHook = game:GetService("ReplicatedStorage"):FindFirstChild("GrappleHook"):Clone()
if inventory:FindFirstChild("GravityCoil") then
print("Already")
else
gravityCoil.Parent = inventory
end
inventory.GravityCoil.Equipped:Connect(function()
mps:PromptGamePassPurchase(player, gcid)
end)