Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Cloning decal into a player's head on spawn problem..?

What is wrong with clone face to the player's Head on spawn? It works good in Roblox Studio but not in game??

It is a local script and is in the StarterGui

local player = game.Players.LocalPlayer
save = player.FaceSave.Value

player.CharacterAdded:connect(function(character)
local clone = game.Lighting.Faces:FindFirstChild(save):Clone()
clone.Parent = player.Character.Head
wait(2)
for i,v in pairs(character.Head:GetChildren()) do
if v.ClassName == "Decal" and v.Name ~= save then
v:Destroy()
end
end
end)

1 answer

This happens because local scripts run much faster then normal so it runs before the character is created. To fix put

repeat wait(.1) until player.Character

At the first line of the script and it should work disregarding any errors in the script itself.

This discussion is preserved as it was. New answers, comments, and votes are closed.