I’m making a simple game for coding practice. In this game, you can spawn a Sphere part and can arbitrarily give it special properties. An issue I am running into is with applying a Decal to a part, and having it be visible in-game.
Through Studio, spawning in a Part, adding the Decal instance, and adding an ID to the Texture property displays the decal correctly. However, the same does not apply when trying it through Script.
However, this is unideal because I want decals to be arbitrarily created and inserted, not pre-created and pre-inserted. Is there any way to allow my system to work?
I know that the function itself works because it prints the correct ID when I run it, and it displays the correct string in the Decal instance itself when inspecting it via the workspace while my game is running.
as well as changing each variant of “robloxID” to “tostring(robloxID)”, but that didn’t work either. I checked the Texture property and the value does display correctly, the decal itself just doesn’t show up in-game for some reason.
works perfectly fine for me with the following layout:
Have you tried printing robloxID to make sure that the ID is supplied properly? Have you also verified that the correct decal.Face is selected?
@sussy_bacoo So did I, but it seems that is not for decals, but it is for images in UI.
EDIT: After re-reading your post I noticed that you had a sphere. In that case it seems that “rbxassetid://” is the correct prefix. The following code worked for me, with the same layout as pictured above.
Though I need the Decal ID to be arbitrarily applied as the ID gets passed through a function, so I sadly can’t use that method of having it be pre-written regardless
It works, I think! Still tinkering around with a few things, it worked when I copied the same line into my pre-existing script thankfully, but overall the texture does display now. Thank you!
Yeah, this works! Just stopped working when I retried it in my current script. Again, no idea why. I’ll probably have to rewrite some stuff to account for this method, but I appreciate this solution. Thank you