market = game:GetService("MarketplaceService")
val = script.item
scanning = true
while scanning do
asset = market:GetProductInfo(val.Value)
-- print("scanning ID ", val.Value)
if asset.AssetTypeId == 11 or asset.AssetTypeId == 13 then
scanning = false
-- print("ID:",val.Value," is a clothing item! ID successful!")
else
val.Value = val.Value +1
-- print("ID failed trying ",val.Value)
end
end
script.Parent.MouseButton1Click:connect(function(plr)
market:PromptPurchase(plr, val.Value)
end)
This script always says the plr on line 22 is nil. Help? This is a script inside of a TextButton Surface GUI.

4 comments
Now when I clicked it, nothing happens. No error.
It's a local script, and where is it?
It's a local script inside of the Text Button. The text button is in a surface gui, not a screen gui.
Oh, well. That's embarrassing. This will work with a screen GUI, to my knowledge. Not yet surface gui.