Who can help me with gamepass shop system

Hello who can help me with gamepass system
Script :

local gamepassIDs = {
	39633642
}

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
	if frame.GamepassPrice.Text == info.PriceInRobux then
		frame.GamepassPrice.Text = info.PriceInRobux .. " Robux"
		frame.BuyButton.Text = "Buy"
	else
		frame.GamepassPrice.Text = ""
		frame.BuyButton.Text = "Not for sale"
	end
	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.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


script.Parent.CloseButton.MouseButton1Click:Connect(function()
	
	script.Parent.Visible = not script.Parent.Visible
end)

script.Parent.Parent.GamepassShopButton.MouseButton1Click:Connect(function()
	
	script.Parent.Visible = not script.Parent.Visible
end)
1 Like

What and where exactly is your problem?

3 Likes

My problem

i need to make a text not for sale if gamepass don`t have prise and if this not for sale this changes color

1 Like

Change this line to

	if info.PriceInRobux then

You don’t need to compare the text, just if price in robux is not nil

2 Likes