[HELP] Buy Shirt button doesn't works

I need help with this script:

--Variables:

local P = game.Players.LocalPlayer
local PN = P.Name
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local comprar = script.Parent.Comprar
local costeP = script.Parent.CosteP
local nombreP = script.Parent.NombreP
local prendaImagen = script.Parent.Prenda
local CerrarG = script.Parent.CerrarGUI
local probarP = script.Parent.ProbarP
local ShirtID = 3452655081
local ShirtIDW = "http://www.roblox.com/asset/?id=3452655081" --id de la prenda "3452655081"
local MarketplaceService = game:GetService("MarketplaceService")

--




--Codigo:


-- Borrar GUI con la " X " 

CerrarG.MouseButton1Click:Connect(function()
	
script.Parent:Destroy()
	
end)

--

---

-- Mostrar ropa en ImagenLabel:

probarP.MouseButton1Click:Connect(function()
	
	game.Workspace[PN].Shirt.ShirtTemplate = ShirtIDW
		
end)



--

---

-- Comprar Prenda:

comprar.MouseButton1Click:Connect(function()

	game:GetService("MarketplaceService"):PromptPurchase(PN,ShirtID)
	
end)

--

Its the " compra " button but doesn’t works.
It gives me this error.

Where is line 69? I don’t understand it if I won’t know which line 69 is

– Comprar Prenda:

its it, the buy button but doesnt works.

Try using P.Name and not PN just try it

image

Doesn’t work

Oh and use MarketplaceService variable you made:

MarketplaceService:PromptPurchase(PN,ShirtID)

What u wanna mean, where? In what line? Where do I use MarketplaceService ?

At the line: game:GetService(“MarketplaceService”)

Its game:GetService(“MarketplaceService”)
I dont know what you wanna mean:

" Oh and use MarketplaceService variable you made:

MarketplaceService:PromptPurchase(PN,ShirtID) "

Well I mean if you look to the top and the variables you see already made MarketplaceService variable

Do you have the correct ID of the shirt because “Unable to cast VALUE to object”

Means the value of the shirt ID is incorrect

its correct but doesnt works…
It doesnt gives me the thing for buy it

Impossible to have a error at a comment: “-- Comprar Prenda:”

it gives me an error, idk why…

Oh… Well when I don’t know something I just watch YouTube

And I’m pretty new to building, and I’m not the best scripter

PN should be the Player instance and not the Players name. Just replace it with your P variable

Example:

game:GetService("MarketplaceService"):PromptPurchase(P,ShirtID)
2 Likes

Oh man that was so smart I haven’t thought about that!

But I don’t have that problem I don’t know if it works actually…

Looks like it works