How Do I Make This Work

Uhhh is it supposed to be strings or numbers?

Cause that’s printing false and other stuff.

Also when it works the is what printes
10:00:39.749 920587237 - Client - AdvertisementsClient:34
10:00:39.750 true - Client - AdvertisementsClient:35
10:00:39.750 Done - Client - AdvertisementsClient:38
10:00:39.821 Complete - Client - AdvertisementsClient:46

1 Like

WAIT, you’re comparing a number to a string that might be the problem.

How do I change “enterPressed” to it happens when I click off

if string.len(enteredId) > 0 and enterPressed then

What would I do instead--------

What’s enterpressed supposed to be.

Its the function?

idBox.FocusLost:Connect(function(enterPressed)

you need to compare enteredId to something else like just 0 or soemthing.

It can’t be a string because it’ll never be greater than the string.

Try this:

local marketplaceService = game:GetService("MarketplaceService")
function focusLost()
	local enteredId = idBox.Text
	
	if string.len(enteredId) > 0 then
		local productInfo = marketplaceService:GetProductInfo(enteredId)
		if productInfo then

			local name = productInfo.Name
			nameLbl.Text = name

			thumbnailImg.Image = "https://www.roblox.com/asset-thumbnail/image?assetId=" .. enteredId .. "&width=420&height=420&format=png"
		end
	end
end

idBox.FocusLost:Connect(focusLost)
1 Like

no, actually he uses string.len function that returns the length of string given (in numbers) so he compare number to number and it will work

That looks like it’ll work.-----

ohh then what could be happing is enterpressed is greater than enteredId

That worked! THANK YOU SO MUCH!!!

and that’s why it don’t print done.

you see, he says that he need to show when enter pressed but focus lost either, so enterPressed is excess in this situation, and what are you saying is “if string.len(enteredId) > enterPressed then”

Lets gooo!! I told you would have got it.

check that post as solution please

1 Like

Good job on finding out that it had to be a 0.