Changing player's face from script doesn't render

Currently I’m making a character customization system. The player spawns as a StarterCharacter and is given the option to customize their face, value of the face changes, no errors, nothing seems wrong, but nothing is rendered.

Rundown of my code:
It gets the facevalue from a replicated storage folder and changes the UI to have the preview of the face (preview works), then applies the face to the player’s face texture once the button is clicked. Value changes in the player’s face texture, but nothing is rendered. Print statement also prints the correct value. I’ve gone into server-side while play testing and nothing is shown, but I can manually paste in the asset id and it will appear. I’ve relaunched my Studio, changed the “rbxassetid://” but nothing I do seems to work.

The script is a server-side script inside of the UI.
Code for handling face change:

for _,facevalue in pairs(game.ReplicatedStorage:WaitForChild("Customization"):WaitForChild("Faces"):GetChildren()) do
	local ClothButton = script.ClothButton:Clone()
	ClothButton.Image = "https://www.roblox.com/asset-thumbnail/image?assetId="..facevalue.Name.."&width=420&height=420&format=png"
	ClothButton.Parent = script.Parent:WaitForChild("Frame2"):WaitForChild("Faces")
	ClothButton.MouseButton1Click:Connect(function()
		local Char = game.Workspace[Player.Name]
		Char:WaitForChild("Head"):WaitForChild("face").Texture = "rbxassetid://"..facevalue.Name
		print("Face: "..facevalue.Name)
	end)
end

Is it really supposed to be facevalue.Name? It’s really difficult to see where you’re going with this script

1 Like

Inside ReplicatedStorage, theres “Customization” folder, and then inside of that folder is the “Faces” folder. Inside the faces folder is every given face that the player can equip, and the face’s assetid is just the name of the IntValue.

1 Like

Why .Name? Shouldn’t it be .Value?

1 Like

Inside the “faces” folder it’s a bunch of IntValues with the Names of the intvalues being the assetid. I tried to put the Value of the intvalues being the assetid and changing the script to be facevalue.value, but even that doesnt work.

I found an alternative that works as a solution, but that didn’t fix the original problem that was at hand.

The alternative I found was to pre-make the face and store it inside the display value, then destory the player’s current face and clone the pre-made one. That worked, but while pasting assetids into the decals for the faces, I found an issue.

While using this alternative, I found this issue;
When going to the roblox website and copying assetids for classic faces, pasting them into a decal would display the correct face, but the assetid would change. If I change the assetid to the old id using a script, the id would not auto-apply the change as if you were to paste them in manually. However, the old assetid would display properly on the ImageLabel that I have for preview. I find this very odd.

Does anyone know why this happens?

1 Like

I encountered this bug a few years back myself, I believe it might be related to Roblox not replicating the Texture change to clients for some reason, since, if you change the Texture on the client, it works perfectly, my solution was to change the faces on the clients and the server, so something like

local face --Path to face
local faceRemote --Path to the RemoteEvent
face.Texture = "rbxassetid://" .. faceId
faceRemote:FireAllClients(face, faceId)

Then, in a seperate LocalScript

faceRemote.OnClientEvent:Connect(function(face, faceId)
    face.Texture = "rbxassetid://" .. faceId
end)

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