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
✓ ANSWER ACCEPTED
The current identity (2) cannot Class security check (lacking permission 6)?
1 answer
✓ Accepted answer
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
1 comment
0
ill try that but first ill do local scripts
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
This doesn't seem like all your code is here.
It is impossible for the given code to error "cannot Class security check". Please provide all of your code so that we can help.
Nevermind I'm wrong, you're doing game:GetChildren() which sometimes returns hidden objects on which you cannot check for the class.
what do i do then