Why i get this error: Current identity (2) cannot settings() (lacking permission 1)?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want make that the Gui in my Plugin addapt its color in Roblox studio relative to the Theme. (Exemple: A white Background Gui in White will get a dark Background Gui in Dark Theme)

  2. What is the issue? Include screenshots / videos if possible!
    I get this error( see the Theme Title and under):

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

i have read some others Topics, but it dont help me.

The error message
    "The current identity (2) cannot settings() (lacking permission 1)"
My Code
  	local GuiObjects = {}

for i,v in pairs(script.Parent:GetChildren())do
	if v:IsA("Frame") or v:IsA("TextLabel") or v:IsA("TextBox") or v:IsA("TextButton") or v:IsA("ImageLabel")then
		table.insert(GuiObjects, i, v)
	end
end

local function syncGuiColors(objects)
	local function setColors()
		for _, guiObject in pairs(objects)do
			
			-- Sync background color
			if not guiObject:IsA("ImageLabel") then
				guiObject.BackgroundColor3 = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.MainBackground)
			else
				guiObject.BackgroundColor3 = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.MainBackground)
				guiObject.ImageColor3 = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.MainBackground)
			end
			
			-- Sync text color
			if guiObject:IsA("TextBox") or guiObject:IsA("TextButton") or guiObject:IsA("TextLabel") then
				guiObject.TextColor3 = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.MainText)
			end
		end
	end
	-- Run 'setColors()' function to initally sync colors
	setColors()
	-- Connect 'ThemeChanged' event to the 'setColors()' function
	settings().Studio.ThemeChanged:Connect(setColors)
end

-- Run 'syncGuiColors()' function to sync colors of provided objects
syncGuiColors(GuiObjects)

Pls i realy Need help.

2 Likes

This error means you’re trying to access settings() from a Script, not a plugin. Here’s a helpful thread by Dekkonot on the different identities code can be run at: A Current Explanation of Normal Identities and Security Tags

3 Likes

This means that the code isn’t running as a plugin. Could you give more info on how youre running it?

@ArticGamerTV the error doesn’t have anything to do with inserting into a table.