You can write your topic however you want, but you need to answer these questions:
-
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) -
What is the issue? Include screenshots / videos if possible!
I get this error( see the Theme Title and under): -
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.