I have absolutely no idea what's causing this issue. This script is supposed to change the face of a humanoid model named Character to whatever is passed through the "value" parameter. When I test it, the face of the Character is always blank. Here's my script.

--This is a remote event in the workspace that is being triggered by an outside script
script.ChangeFace.OnServerEvent:connect(function(player, value)
	local charFind = game.Workspace:FindFirstChild("Character") --Looking for the Character humanoid model, which contains the head, legs, arms, torso, the usual stuff a humanoid model contains
	if charFind then
		local findFace = charFind.Head:FindFirstChildOfClass("Decal") --Finding the face decal
		if findFace then
			local findFace2 = game.ServerStorage.Faces:GetDescendants() --In ServerStorage, there is a file named Faces with 4 IntValues. These contain the numbers at the end of the decal URLs (ex: 7074764)
			for i, v in pairs(findFace2) do
				if v.Name == tostring(value) then --"value" is the title of the IntValue being chosen, a number which ranges from 1 to 4 because there are 4 different faces that can be chosen in the Faces folder in ServerStorage
					findFace:Destroy() --Destroy the old face decal to replace it with a new one
					local newFace = Instance.new("Decal", charFind.Head)
					newFace.Name = "face"
					newFace.Texture = "rbxassetid://" ..v.Parent.Value --Here, the new ID of the decal is made, but when I test it, the face is blank.
					break
				end
			end		
		end
	end	
end)

If anybody could help me with this, I'd very much appreciate it!

3 comments

0

Try using ContentProvider. http://wiki.roblox.com/index.php?title=API:Class/ContentProvider. You could use the method PreloadAsync

0

ContentProvider is client-side only; the script is meant to run from the server

0

PreloadAsync also fails for me nearly every single time, returning simply, "ContentProvider:PreloadAsync() failed for rbxassetid://7074764"