Image not changing after setting ID?

I’m working on a way to make it so when you insert an ID into a TextBox, the image changes to the ID in the TextBox that was set. The thing is, It doesn’t seem to be working and I’m getting no errors either.

Example:

Code:

local Screens = game.Workspace.Screens
local id = script.Parent.Text

script.Parent.Parent.Parent.Image.ImageLabel.Image = "rbxassetid://"..tostring(id)
1 Like

Not like the script once. But yeah you can just connect the TextBox to a FocusLost event and do the Magic in there.

1 Like

For example

local Screens = game.Workspace.Screens
local id = script.Parent
local enReq = true -- Only change text when focus lost on enter press

id.FocusLost:Connect(function(enterpressed)
    if enReq and not enterpressed then
        return
    end
    script.Parent.Parent.Parent.Image.ImageLabel.Image = "rbxassetid://"..tostring(id.Text)
end)

I’d try using focus lost, because what it’s doing right now is setting it to the text when the script runs (when the game starts)

Try this:

local Screens = game.Workspace.Screens

local id = script.Parent
local imageLabel = script.Parent.Parent.Parent:WaitForChild("Image"):WaitForChild("ImageLabel")

id.FocusLost:Connect(function()
	imageLabel.Image = "rbxassetid://"..tostring(id.Text)
end)
1 Like

It seems that the ID of the image doesn’t change nor the image…

Try adding a print in the function after it sets it and tell me if it prints. Seems kind of weird why it would do that, it should work. But I very well could have messed something up.

It seems to print Image changed but the ImageID in the Image stays the same?

image

image

Try this. This might work, but let me know if it doesn’t of course

local Screens = game.Workspace.Screens

local id = script.Parent
local imageLabel = script.Parent.Parent.Parent:WaitForChild("Image"):WaitForChild("ImageLabel")

id.FocusLost:Connect(function()
	imageLabel.Image = id.Text
end)

Hmm… doesn’t seem to do anything

Do you mind sending me a version of the place as a file? It would make this a million times easier, but you don’t have to if you don’t want to. I completely understand if you don’t.

1 Like

On-site ids are different from studio ids.

You will have to find a way of converting a site id to a studio id.

1 Like