Faces not working on my ingame avatar editor

alrighty! hello everyone

i’m trying to make an avatar editor, using item ids: it works on everything, really: but not bundles and faces (i don’t really care about the bundles), anyway

i tried to make it support faces but it didn’t work, after i put the id for a face. this happens
(roblox isn’t letting me upload, it just doesn’t give people a face.)

here’s the code i used,

-- this uses ids from a textbox to give people items
elseif v:IsA("Decal") then
face.Texture = "rbxassetid://"..number
-- face itself is a variable sending it to the players face, this isn't the entire script.

thank you! :happy2:

Could you display the textbox script (or atleast a few lines) and the face variable?

1 Like

oh: sure!
the face variable is

local face = player.Character.Head.face

the script is in serverscriptservice, but here’s the script on the textbox either way

local event = workspace:WaitForChild("AvatarEvent")
local text

script.Parent.FocusLost:Connect(function(enter)
	if not enter then return end
	text = script.Parent.Text
	text = text:gsub("[%a%p]+","")
	local number = tonumber(text)
	if not number then return end
	event:FireServer(number)
end)

thanks for responding, glad to get help from you!

The problem could be that the asset ID you’re setting the face to is not an actual texture. There’s a really cool way with InsertService to grab the Texture ID for a specific face

local insertService = game:GetService("InsertService") 

local function GetFaceIDFromAsset(id)
	local asset = insertService:LoadAsset(id)

	if (asset) then
		return asset:FindFirstChildOfClass("Decal").Texture
	end
end

For example, if we wanted this face in the game, the assetID itself isn’t an actual Image so it can’t be displayed on the face.

But using that function with InsertService, we can easily get the correct texture ID to put a face onto that character.

image

Let me know if you need further assistance and mark as solution if this helped you! :grinning_face_with_smiling_eyes:

1 Like