local parts = script.Parent:GetChildren()
for i,v in pairs(parts) do
if v.Parent.Name == "1_Forest" or v.Parent.Parent == "1_Forest" then
if v.Name ~= "teleport" and v.Name ~= "teleportback" then
if v.ClassName == "Part" then
local d = false
v.Touched:connect(function(p)
if d == false then
d = true
if p.ClassName ~= "Accessory" then
p.Parent:WaitForChild("Humanoid").Health = 0
end
d = false
end
end)
end
end
end
end
on the idea the script works fine. But after a character's respawn I get a lot of errors of my accessories, like
Infinite yield possible on 'Workspace.TheAdmiralMaxwell.Beard:WaitForChild("Humanoid")

3 comments
It's more of a warning than an error, because that output is yellow and not red. It might be a glitch in roblox's CoreGuis. I get it as well.
In any case, this greatly reduces optimization. It needs to be solved
try using pcall(), that way any errors don't break the script. A helpful post is found on this forum thread: https://forum.roblox.com/Forum/ShowPost.aspx?PostID=10381896