I re-wrote your code a bit and gave you a couple options on how you want the timing to work when changing the characters' head colors. It's probably a bit overkill for what you're doing, but it just shows how many different ways you can approach a simple problem (Of course, you could always just fix your for loop and call it a day :p)
local desiredColor = Color3.fromRGB(13, 105, 172)
local function setCharacterHeadColor(character)
local head = character:WaitForChild("Head", 5)
if head then
head.Color = desiredColor
end
end
local function setAllCharacterHeadColors()
for _, player in pairs(game.Players:GetPlayers()) do
spawn(function()
while not player.Character do wait() end
setCharacterHeadColor(player.Character)
end)
end
end
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(setCharacterHeadColor)
end)
while wait(10) do
setAllCharacterHeadColors()
end
2 comments
you could do character added
Good idea; I've edited it now.