Make a menu where when you click another box, the previous tick is set to invisble and the one you clicked is set to visible (it is very hard to explain)
Code
As of now, this is my code:
local mainFrame = script.Parent.Parent.Parent.Parent
local settingsGUI = mainFrame.MainFrameSettings
local menuGUI = mainFrame.Menu
local positions = {
Left = UDim2.new(1, 0, 0, 0),
Middle = UDim2.new(0, 0, 0, 0),
Right = UDim2.new(-1, 0, 0, 0),
}
local graphicsFolder = settingsGUI.Graphics
local lightingFolder = settingsGUI.Lighting
local musicFolder = settingsGUI.Music
local activated = false
local debounce = false
-- Settings
script.Parent.Parent.SettingsButton.MouseButton1Click:Connect(function()
menuGUI:TweenPosition(positions.Right)
wait(0.8)
settingsGUI:TweenPosition(positions.Middle)
end)
for _, setting in pairs(graphicsFolder:GetChildren()) do
if setting.ClassName == "ImageButton" then
setting.MouseButton1Click:Connect(function()
local usingValue = setting:FindFirstChild("Using").Value
setting.MouseButton1Click:Connect(function()
if usingValue == false then
print("false")
setting:FindFirstChild("SettingBeingUsed").ImageTransparency = 0
else
print("true")
setting:FindFirstChild("SettingBeingUsed").ImageTransparency = 1
end
end)
end)
end
end
Once clicked you can loop through the All buttons and do
for i , v in pairs(graphicsFolder:GetChildren()) do
if v ~= setting then -- Checkings if its not the One we clicked
local Image = v:FindFirstChildOflClass("ImageLabel") -- Finds First Child of Class Image Label
Image.Visible = false
end
I got to go , so thats all I can give hope this helps !
Also I can sense some memory leak , you creating a new MouseButton1Click event for the Button once you click , basically a nested event. Why are you doing that?
You can shorten your script to something like this.
for _, setting in pairs(graphicsFolder:GetChildren()) do
if setting:IsA("ImageButton") then
setting.MouseButton1Click:Connect(function()
local usingValue = setting:FindFirstChild("Using").Value
if usingValue == false then
print("false")
setting:FindFirstChild("SettingBeingUsed").ImageTransparency = 0
else
print("true")
setting:FindFirstChild("SettingBeingUsed").ImageTransparency = 1
end
for i , v in pairs(graphicsFolder:GetChildren()) do
if v ~= setting then -- Checkings if its not the One we clicked
local Image = v:FindFirstChildOflClass("ImageLabel") -- Finds First Child of Class Image Label
Image.Visible = false
end
end
end)
end
end
for _, setting in pairs(graphicsFolder:GetChildren()) do
if setting.ClassName == "ImageButton" then
setting.MouseButton1Click:Connect(function()
local descendants = setting.Parent:GetDescendants()
for _, image in pairs(descendants) do
if image.Name == "GraphicSetting" then
image.Parent = setting
end
end
end)
end
end
Memory leaks are some stuffs in memory those are cleaned up , for example in your script when you click the Button you are creating one more setting.MouseButton1Click:Connect(function() , doing this will create a connect for MouseButton1Click in the memory and each time you click more and more of the Connection will be created and they exist in memory .
Umm sorry to interrupt you , but you marked you question as the solution , it would be only helpful for me if you mark my answer as the solution @GamingExpert0312