Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to add FaceTemplate to Avatar Editor?

Asked by
RBLXHS 9
4 years ago

I am wondering how I can grab the FaceTemplate to allow users to change their faces. I have the ShirtsTemplate and PantsTemplate already but I'd like to know how to add the FaceTemplate, if there is one. I have tried looking this up but I am not finding anything that can help me.

Here is the code, notice that there is no facetemplate to grab the face from the catalog:

if not workspace:FindFirstChild("AvatarEvent") then
    local event = Instance.new("RemoteEvent")
    event.Name = "AvatarEvent"
    event.Parent = workspace
end
local event = workspace.AvatarEvent
local insertS = game:GetService("InsertService")

event.OnServerEvent:Connect(function(player, id)
    local number = tonumber(id)
    if not number then return end
    local asset
    local char = player.Character
    local success = pcall(function()
        asset = insertS:LoadAsset(number)
    end)

    if not success then return end
    local child = asset:GetChildren()
    for _,v in pairs(child) do
        if v:IsA("Accessory") then
            char.Humanoid:AddAccessory(v)
        elseif v:IsA("Shirt") then
            local templ = v.ShirtTemplate
            char.Shirt.ShirtTemplate = templ
        elseif v:IsA("Pants") then
            local templ = v.PantsTemplate
            char.Pants.PantsTemplate = templ
        end
    end
    asset:Destroy()
end)
0
Maybe instead of a FaceTemplate it is a body part? Any ideas anyone? RBLXHS 9 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Faces are handled through Decals. So you can easily just have a decal that you can change the .Texture to the AssetId of the image of the face you want.

Ad

Answer this question