Face becomes blank after changing decal ID

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 am trying to create a script inside of part that when a player touches it, they receive a random face.

  2. What is the issue? Include screenshots / videos if possible!
    When the player touches the part, the face decal successfully changes, but it turns the face blank instead of displaying the new decal. Interestingly, the Texture turns to only the number, without “rbxassetid://”. When I tried adding the “rbxassetid://” through Explorer when playtesting, it had no effect.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    This DevForum post had the identical problem, but it did not solve my problem. It’s also worth noting that this script throws no error messages.

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!

This is my full script, please don’t mind if it is messy, I’m not a very good programmer and this is kind of an amalgamation of different scripts.

FaceId = {141728790, 255827175, 277950647, 398675764, 268603331, 209994929, 173789324, 21311601}

--Variables
local head = script.Parent

function onTouched(part)
	local h = part.Parent:findFirstChild("Humanoid")
	
	if h ~= nil then
		
		if part.Parent:findFirstChild("Head"):findFirstChild("face").Texture == nil then return end
		
		if part.Parent:findFirstChild("Head"):findFirstChild("face").Texture ~= nil then
			
			local var = FaceId[math.random(1,8)]
			wait(.1)
			part.Parent:findFirstChild("Head"):findFirstChild("face").Texture = ("rbxassetid://" .. var)
			wait(.1)
			part.Parent:findFirstChild("Head"):findFirstChild("face").Texture = var
			
		end
	end
end


script.Parent.Touched:connect(onTouched)

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.

The catalog ID does not match with the decal ID at all. Performing this line below will create a Model instance containing the decal.

game:GetService("InsertService"):LoadAsset(141728790)

Otherwise you can look for their actual decal ID by loading in the faces and then pick the new ID out of that…

Pointed me in the right direction, thanks! Didn’t realize there was a major difference between Catalog ID and Decal ID. Another problem was when I stupidly wrote part.Parent:findFirstChild("Head"):findFirstChild("face").Texture = var, whch overwrote the previous line so it only gave the ID without rbxassetid://. Thanks for the help!

1 Like

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