Setting decal by ID does not work

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I need to make a system to change the background of the stage in a game.

  1. What is the issue? Include screenshots / videos if possible!

Loading in images does not work

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I have tried changing the “rbxassetid://” to “roblox.com/asset/?id=” but it did not work. I also tried checking the dev hub, but I could not find a solution

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

  • It is a Decal, not an ImageLabel
  • The Part of which the Decal should be on is called “Background”

My script is included here:

script.Parent.BGFrame.ChangeBG.OnServerEvent:Connect(function(plr,txt)
	game.Workspace.Background.Decal.Texture = "rbxassetid//"..txt
end)

I know my script syntax is valid because there are no syntax warnings, and the “Texture” property is changed according to the input.

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

1 Like

you are calling that function from where? “ServerScriptService”? You are calling it from outside the workspace, try to put the script inside the image.

Maybe do tonumber()? (lalalalimit)

I am calling it from GUIs.

I went and tried your idea, but it did not work.

Also I forgot to mention that the input is coming from a TextBox.

Did you forget to add a colon before the double slashes? (You said you tried it but in your code you don’t have it.)

script.Parent.BGFrame.ChangeBG.OnServerEvent:Connect(function(plr,txt)
    game.Workspace.Background.Decal.Texture = "https://www.roblox.com/asset-thumbnail/image?assetId=" .. txt .. "&width=420&height=420&format=png"
end)

Roblox doesn’t want to let us find the original asset ID so we have to use asset thumbnails.

2 Likes

It worked! Thanks!

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