Help me(no errors)

so im making a game and when i change textbox the script still uses old text for example the default text for textbox is 0 and i change it to any other number it will still think that textbox text is 0
script:

local MarketplaceService = game:GetService("MarketplaceService")

script.Parent.TextButton.MouseButton1Click:Connect(function()


	local ASSET_ID = tonumber(script.Parent.TextBox.Text)
	

	
	local asset = MarketplaceService:GetProductInfo(ASSET_ID)
	print(asset.Name .. " :: " .. asset.Description.. " :: ".. asset.Sales)
	end)

3 Likes

remove the “tonumber” function and try again

1 Like

The :GetProductInfo() must have a number in it for the ID.
Having tonnumber() is mandatory, as the Text always gives a string, even if it’s just a number.

3 Likes

same thing didnt fix anything and im pretty sure u need to have tonumber

Try this

local MarketplaceService = game:GetService("MarketplaceService")

script.Parent.TextButton.MouseButton1Click:Connect(function()
	local ASSET_ID = tonumber(script.Parent.TextBox.Text)

	local asset = MarketplaceService:GetProductInfo(ASSET_ID)
	print(asset.Name .. " :: " .. asset.Description .. " :: " .. asset.Sales)
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.