Hi, im trying to make an in-game inventory which will show the passes which player have bought.
I’ve tried following an Inventory tutorial then adding ‘if player has pass’ then show the item in inventory but it doesnt work. Googled everywhere and cant find a tutorial to show what im after, all just show player backpack items not bought items.
local MarketPlaceService = game:GetService("MarketplaceService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local RainbowpassID = 86294878
local ItemFrame = script.Parent:FindFirstChild("ScrollingFrame")
local Trail = game.ServerStorage["RainbowTrail"]
local image = script.Parent.Frame.ScrollingFrame.Sample
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character) -- This was needed
local success, hasPass = pcall(function() -- Changing the pcall to the correct format
return MarketPlaceService:UserOwnsGamePassAsync(player.UserId, RainbowpassID)
end)
if success then -- Checking if successful
if hasPass then -- Checking if the player has the
local ItemButton = ItemFrame:FindFirstChild("Sample"):Clone()
ItemButton.Visible = true
ItemButton.Parent = ItemFrame
image = "rbxassetid://10939860799"
end
end
end)
end)
Heres the script im using. It checks whether they have bought “rainbowpass” and if they do it should display into the inventory and showthe image of rainbowpass too!
Anyone know how to help? I’d appreciate it! Thankyou