Textbox not changing decal on part

image
so basically whenever you enter a id into the textbox, it will show it in the viewport frame on the part but it no worke!!

local text = script.Parent

text.FocusLost:Connect(function(enterpressed)
	if enterpressed then
		script.Parent.Parent.ViewportFrame.gamepassball.Decal.Texture = "http://www.roblox.com/asset/?id="..text.Text
	end
end)

this is how the explorer is looking
image
gamepass ball is the part

Try this:

local decalid = (decal id)
string.format("rbxthumb://type=Asset&id=%s&w=420&h=420", decalid)

still didnt work maybe cause i set it up wrong?

local text = script.Parent
local decalid = (text.Text)
local yes = string.format("rbxthumb://type=Asset&id=%s&w=420&h=420", decalid)

text.FocusLost:Connect(function(enterpressed)
	if enterpressed then
		script.Parent.Parent.ViewportFrame.gamepassball.Decal.Texture = yes
	end
end)

Maybe don’t call it as a variable.

I think if you just use:
"rbxassetid://"..text.Text
then it should work.

i’ve already tried that and it didnt work

still didnt work aaaaaaaaaaaaaaaaaaa

Is there a reason you’re using a Viewport Frame instead of an Image Label?

Check here:

because you cant get a image id from a decal id

im debating if i should use this or not, because a viewport frame would better represent what it would look like on the part but idk

I replicated your UI and your code works perfectly fine. I’m unsure why yours isn’t working.

This is my working build:
viewport decal.rbxl (43.6 KB)

i did that but now the textbox text is returning as nothing

this what it be
image

You could check if Text.FocusLost is actually being called or if the condition is true by adding print statements to the code like this:

local text = script.Parent

text.FocusLost:Connect(function(enterpressed)
    print("focus lost")
	if enterpressed then
        print("yes")
		script.Parent.Parent.ViewportFrame.gamepassball.Decal.Texture = "http://www.roblox.com/asset/?id="..text.Text
	end
end)

Then you could check the console to see if it printed or if there were any errors.

you think i havent tried that before going to a devforum? i said thats not my problem anymore its that the decal is working but its invisible/not getting set correctly

Oh ok, I was just making sure. If you’re still debating between a Viewport Frame and an Image Label, you should try the Image Label and see how you like it (if it works)

Try using rbxassetid:// then the textbox text