How would I find the texture of a face with a script?

I’m not trying to get the thing they have entered. I’m trying to get the texture id, from a face id being entered. As roblox uses texture IDs instead of actual catalog face ids for faces in games.

So using InsertService, you can get any asset from the catalog and put them in the studio, this applies for accessories and faces. The LoadAsset function returns a model containing the Instance from the asset. In this case, putting a face Id will return a model containing a Decal with the ImageID.

In conclusion:

local InsertService = game:GetService("InsertService")

function GetFaceImage(FaceID) --the ID from the catalog
    local AssetModel = InsertService:LoadAsset(FaceID)
    if AssetModel then
        return AssetModel:FindFirstChildOfClass("Decal").Texture --the ImageID for the face
    end
end

use InsertService:LoadAsset for that

local face = 8329679
local faceId = game:GetService("InsertService"):LoadAsset(face).face.Texture

I hope this site explains you what you need, you also can use the Name instead of the ID, and then COMPARE the id with all the id of the array and return a decal if both id‘s matches.

Ah yes this is an interesting one. You could do something such as a repeat loop until you find a texture, but that wouldn’t be very accurate.

So, use the server and call a remote function to get it.

Put this code inside a script in ServerScriptService

Then from the client, Invoke the remotefunction and it will return the id or nil, depending on whether or not the ID is valid.

You can read more about InvokeServer in the link above if you’re unsure how it works

@lexishh, i hope this can work:

Thanks this function, you can also get the TextureID thanks a simple object ID, see more on the second link

Unfortunatley this didn’t work for me.

I’ll try it in a minute if the others don’t work.

1 Like

I’ll see if this works for me. Thanks!

All InsertService answers just come to an int64 error. I’m confused.

Show us the error, else we can‘t help

image

you need to put a number, not a string.

what you did :
id = "1337"

what you need to do :
id = 1337

I’m using the user’s input, through a textbox, It’s a number though.

Use tonumber() to convert it to a number

2 Likes

image Like this?

yes

30charrahhhhhhJHHGUFKUIRHDGHUIQRLE

Still the same error as before.

im just gonna rewrite the whole function

local is = game:GetService("InsertService")    

function ApplyFace()
    	local id = script.Parent.Text
    	local name = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent
    	local faceId = is:LoadAsset(tonumber(id)).face.Texture
    	workspace.name.Head.face.Texture = faceId
    	script.Parent.Text = "Applied"
end

image