for _,child in pairs(game:GetChildren()) do local text = script.Parent text.Text = child.Name local newText = text:Clone() newText.Script:Destroy() newText.Parent = text.Parent newText.Visible = true end
You're getting that error because some children of game
aren't accessible to normal scripts. I don't know what you want to do so I can't suggest a better way, but if you really have to do it this way, use pcall
to prevent the errors, like so:
for _,child in pairs(game:GetChildren()) do pcall(function() local text = script.Parent text.Text = child.Name local newText = text:Clone() newText.Script:Destroy() newText.Parent = text.Parent newText.Visible = true end) end