How Do I Make This Work

I am making a ad system that looks like this

This is what happens to mine and i don’t know why. When I enter the id the game info does not come up like the one in the video above. How do I fix this or make it work.

This is the script inside my UI

--HIDE GUI ON START
local adFrame = script.Parent:WaitForChild("AdFrame")
adFrame.Visible = false

--VARIABLES
local createBtn = script.Parent:WaitForChild("CreateAdButton")
local closeBtn = adFrame:WaitForChild("CloseButton")
local nameLbl = adFrame:WaitForChild("ItemName")
local thumbnailImg = adFrame:WaitForChild("ItemThumbnail")
local confirmBtn = adFrame:WaitForChild("ConfirmButton")
local idBox = adFrame:WaitForChild("ItemIDBox")


--OPEN AND CLOSE GUI WHEN BUTTONS ARE PRESSED
createBtn.MouseButton1Click:Connect(function()
	adFrame.Visible = true
	
	nameLbl.Text = "Item name"
	thumbnailImg.Image = "http://www.roblox.com/asset/?id=9586437451"
	idBox.Text = ""
end)

closeBtn.MouseButton1Click:Connect(function()
	adFrame.Visible = false
end)


--CREATE AD PREVIEW WHEN ID IS ENTERED
local marketplaceService = game:GetService("MarketplaceService")

idBox.FocusLost:Connect(function(enterPressed)
	
	local enteredId = idBox.Text
	
	if string.len(enteredId) > 0 and enterPressed 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)


--SEND MESSAGE TO SERVER TO CREATE AD WHEN CONFIRM BUTTON IS PRESSED
local remoteEvent = game.ReplicatedStorage.Remote:WaitForChild("AdEvent")

confirmBtn.MouseButton1Click:Connect(function()
	
	remoteEvent:FireServer(tonumber(idBox.Text))
	
	adFrame.Visible = false
end)


--PROMPT PLAYER TO BUY PRODUCT OR JOIN PLACE WHEN THEY CLICK ON THE ITEM BUTTON
local teleportService = game:GetService("TeleportService")

remoteEvent.OnClientEvent:Connect(function(button)
	
	if button:FindFirstChild("ID") then
		
		local id = button.ID.Value
		
		local productInfo = marketplaceService:GetProductInfo(id)
		
		local typeId = productInfo.AssetTypeId
		
		if typeId == 9 then
			teleportService:Teleport(id, game.Players.LocalPlayer)
			
		else
			marketplaceService:PromptPurchase(game.Players.LocalPlayer, id)
		end
	end
end)

This is the video I used
(https://www.youtube.com/watch?v=im-sHdc3uIQ&list=PLcx324ToumH7pNmgrJ5WVW_5FmlspnfBO&index=3&ab_channel=HowToRoblox)

7 Likes

I think I found the problem.

Replace this: thumbnailImg.Image = “http://www.roblox.com/asset/?id=9586437451

With this: thumbnailImg.Image = “http://www.roblox.com/asset/?id=”…9586437451

2 Likes

wait why won’t it let me do 2 dots it just makes them 3?

1 Like

This happens when I do that

1 Like

delete one dot idk if you do … it becomes …

1 Like

Do I use 2 dots and not 3 dots

1 Like

yes you use 2 dots for it idk why they made it do three dots on the devform

1 Like

There was no errors but that still dose not give the game info

1 Like

I’m going to read the full script to see if there’s anything else wrong.

1 Like

Wait what is createBtn and closeBtn is it a variable that you didn’t show?

1 Like

Screenshot 2023-08-15 at 09.16.53

There in the variables

--VARIABLES
local createBtn = script.Parent:WaitForChild("CreateAdButton")
local closeBtn = adFrame:WaitForChild("CloseButton")
local nameLbl = adFrame:WaitForChild("ItemName")
local thumbnailImg = adFrame:WaitForChild("ItemThumbnail")
local confirmBtn = adFrame:WaitForChild("ConfirmButton")
local idBox = adFrame:WaitForChild("ItemIDBox")
1 Like

ah okay I thought it was a button I was goanna say you have to do script.parent but yeah, it’s a variable ill continue reading.

1 Like

Yeah, I’ve read everything nothing seemed off, but I hope you can find the reason why.
a potential reason could be it don’t work in studio cause sometimes stuff don’t work in studio, but they work on roblox.

2 Likes

Ok I have not tried that but I will

1 Like

image

Maybe if you turn this on it’ll work.

1 Like

I have all of those on and also it did not work on Roblox

Oh, well I’m telling you when people get up usually at 1:00 PM you will find some advanced scripter that can help you.

2 Likes

delete all the three dots and put the id in the " "

1 Like

Cause I’m not the best at scripting there are people way better than me that can help you.

1 Like

are you sure? cause most of the time for me with decals I have to do those dots?

1 Like