I made a Character Customization so players can edit their avatar in-game but the face feature doesn’t seem to work. I made an ImageButton and a local script inside it. Here’s the script:
Code
script.Parent.MouseButton1Click:Connect(function()
local Character = game.Players.LocalPlayer.Character
local head = Character:WaitForChild("Head")
head.face.Texture = 'rbxassetid://31117267'
Can someone see what’s the problem? The error seem messy.
Also, this is my first time posting here so I’m sorry if I made any mistake. Thanks for your help!!
This is happening because you’re trying to apply a catalog ID to a texture, not an asset ID.
Your buttons already seem to have the proper texture for a face asset, so instead of hard-coding the ID you can set the texture of the face to the ImageButton’s image. This will also allow you to create new face options just by setting the ImageButton’s image, which is very scalable for your use case.
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function ()
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local Head = Character:WaitForChild("Head")
Head.face.Texture = script.Parent.Image
end)