Decal not changing during runtime

Hello!

I have a server script attempting to change a character’s face (I tried changing both the default face decal and I made my own face part attachment), but I can’t for the life of me get the new texture to display, the face just becomes blank.

npc:WaitForChild("Face").Face.ColorMapContent = Content.fromAssetId(face)

Why isn’t this working??? I even tried fromUri and still does not work. ‘face’ contains the asset id of the decals. No errors. Just becomes blank face.

I tried setting the ScriptContext to Script and to Legacy (default), to no avail.

I tried different decals, to no avail. I have wasted 2 hours on this.

If it’s not an editable image, you can use .Texture instead, and afaik ColorMapContent accepts strings as well.
For editable images, you have to use AssetService, as far as I know.
https://create.roblox.com/docs/reference/engine/classes/AssetService#ComposeDecalAsync

No it’s not editable, I have tried .Texture but the same issue.

However I just noticed that the AssetService was off, so I’m going to turning that on.. just in case.

Update: Still didn’t work.

Are you sure you are passing an Image ID and not a Decal or something else?
Those IDs are not changed during runtime to Image automatically; if an ID is static, then get its image ID; otherwise, during runtime, you can use https://create.roblox.com/docs/reference/engine/classes/AssetService#LoadAssetAsync to extract the Image ID.

I just got the AssetId from the store, and I’m passing it as

"rbxassetid://"..tostring(face)

I also tried just doing face but still nada.

So it’s the same image? Ok, it’s static then.
You can quickly convert it to an image ID by creating a decal in edit mode, pasting the ID, and grabbing the ID from the decal; it will be an image ID now.

Also avoid using the concat operation at runtime; you’d better have precomputed strings, etc.
“rbxassetid://00000”

Sorry I may have missunderstood your question earlier, it’s not necessarily one image, the images changes depending on the expression the character is doing. A decal in edit mode though? What does that mean? Sorry, the new APIs are still very new to me..

nevermind missunderstood again. :smiley: sure i can try that

Noted on the last part, thanks.

Copy paste the number part of the string face in a decal/image in studio, if the numbers change you’re using the wrong ID. Simply wait for it to change, then copy the changed value and put that in the script.

i’ll give that a shot and update asap :+1:

(and @NyrionDev ) i appreciate the solution, apparently posting the AssetID doesn’t suffice and you actually have to go on edit mode first for it to parse again. Works lovely now. Thanks both!