#new face
1 messages · Page 1 of 1 (latest)
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
-- Folder setup
local facesFolder = ReplicatedStorage:WaitForChild("Faces")
local eyesFolder = facesFolder:WaitForChild("Eyes")
local mouthsFolder = facesFolder:WaitForChild("Mouths")
local savedFaces = {}
local function getRandomDecal(folder)
local decals = folder:GetChildren()
if #decals == 0 then return nil end
return decals[math.random(1, #decals)]
end
local function applyFace(character, eyesDecal, mouthDecal)
local head = character:WaitForChild("Head", 10)
if not head then return end
task.spawn(function()
local defaultFace = head:FindFirstChild("face")
if defaultFace then defaultFace:Destroy() end
if eyesDecal then
local eyesClone = eyesDecal:Clone()
eyesClone.Name = "Eyes"
eyesClone.Parent = head
end
if mouthDecal then
local mouthClone = mouthDecal:Clone()
mouthClone.Name = "Mouth"
mouthClone.Face = Enum.NormalId.Front
mouthClone.Parent = head
end
end)
end
Players.PlayerAdded:Connect(function(player)
local eyes = getRandomDecal(eyesFolder)
local mouth = getRandomDecal(mouthsFolder)
savedFaces[player] = { eyes = eyes, mouth = mouth }
player.CharacterAdded:Connect(function(character)
character:WaitForChild("Head", 10)
task.defer(function()
local data = savedFaces[player]
if data then
applyFace(character, data.eyes, data.mouth)
end
end)
end)
end)
Players.PlayerRemoving:Connect(function(player)
savedFaces[player] = nil
end)