function onDeath()
local rbxlink = "rbxassetid://" -- Do not change this, or the script will no longer work
local facetexture = "1367341140" -- Change the value in the brackets if you want to use a different face id, do not remove the brackets
local head = script.Parent:FindFirstChild("Head")
if head ~= nil then
for i,v in pairs(head:GetChildren()) do
if v:IsA("Decal") then
pcall(function()
local Decal = game.InsertService:LoadAsset(facetexture):GetChildren()[1]
Decal.Parent = head
end)
v.Texture = rbxlink..facetexture
end
end
end
end
script.Parent.Humanoid.Died:Connect(onDeath)``
Does anyone know why this script isnt working? its a script placed in “StarterCharacterScripts” and its goal is to change the players face on death
hmmm, nothing is about the face. I think you need to use Kaid3n22 script:local Decal = game.InsertService:LoadAsset(rbxlink…facetexture):GetChildren()[1]
The line using InsertService is useless if you’re not gonna destroy the old face, you can just change the old face’s texture. You can delete the whole pcall function.
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
character.Humanoid.Died:Connect(function()
local rbxlink = "rbxassetid://" -- Do not change this, or the script will no longer work
local facetexture = "1367341140" -- Change the value in the brackets if you want to use a different face id, do not remove the brackets
local head = script.Parent:FindFirstChild("Head")
if head ~= nil then
for i,v in pairs(head:GetChildren()) do
if v:IsA("Decal") then
v.Texture = rbxlink..facetexture
end
end
end
end)
This worked for me inside starter character scripts(its a LocalScript but it should work with a Server Script also). Try using prints() and see if the function is actually firing.
i used your script but it didnt change the face at all. here is the current script;
function onDeath()
local rbxlink = “rbxassetid://” – Do not change this, or the script will no longer work
local facetexture = “rbxassetid://1367341140” – Change the value in the brackets if you want to use a different face id, do not remove the brackets
local head = script.Parent:FindFirstChild(“Head”)
if head ~= nil then
for i,v in pairs(head:GetChildren()) do
if v:IsA(“Decal”) then
pcall(function()
local Decal = game.InsertService:LoadAsset(rbxassetid://1367341140):GetChildren()[1]
Decal.Parent = head
end)
v.Texture = rbxlink…facetexture
end
end
end
end
This is needlessly complicated, here is essentially the same thing rewritten.
script.Parent.Humanoid.Died:Connect(function()
local face = script.Parent:FindFirstChild("Head"):FindFirstChildOfClass("Decal")
if face then
face.Texture = "YOUR_ASSET_URL_HERE" -- rbxassetid://########
end
end)
Doing this on the client will only appear on your screen and not others. This is due to something called “FilteringEnabled”. If you want it to appear on every players screen you’ll want to do it in a Server Script.
Put this script inside “ServerScriptService”
game.Players.PlayerAdded:Connect(function(player)--Fires when a player joins the game
player.CharacterAdded:Connect(function(character)--Waits for the player's character to load in
local humanoid = character:WaitForChild("Humanoid")--Waiting for the humanoid to load in
humanoid.Died:Connect(function()
local head = character:FindFirstChild("Head")
if head then
for i,v in pairs(head:GetChildren()) do--Replacing all faces with the dead face
if v:IsA("Decal") then
v.Texture = "rbxassetid://1367341140"
end
end
end
end)
end)
end)