Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

The current identity (2) cannot Class security check (lacking permission 6)?

Asked by 4 years ago

Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).

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

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

1 answer

Log in to vote
0
Answered by
Amiaa16 3227 Moderation Voter Community Moderator
4 years ago

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
0
ill try that but first ill do local scripts Trampyling 43 — 4y
Ad

Answer this question