I have text labels Text itself not working correctly, I have a Value that set to true, and Text is “SELECT” but when false it “LOCKED” but it doesn’t do that, it makes it “SELECT”
function resetButtonColors(magicName, magic)
for _, Button in pairs(ScrollFrame:GetDescendants()) do
if Button:IsA("ImageLabel") then
Button.ImageColor3 = magic and Color3.fromRGB(85, 255, 127) or Color3.fromRGB(255, 0, 0)
elseif Button:IsA("TextLabel") and Button.Name ~= "Element" then
Button.Text = magic and "SELECT" or "LOCKED"
end
end
end
I just need to know what I did wrong and why it not working correctly.
What I was trying to do was like when I have selected the magic, It Set to “SELECTED” and if I chose a other magic it reset what I had picked before to “SELECT” but I have other magics I haven’t unlocked that are set to “SELECT” when they aren’t supposed to and
Button.Text = magic and "SELECT" or "LOCKED"
The magic means PrimaryMagic.Value which is True or False
function resetButtonColors(magicName, magic)
for _, Button in pairs(ScrollFrame:GetDescendants()) do
if Button:IsA("ImageLabel") then
if Button.ImageColor3 ~= Color3.fromRGB(255, 0, 0) then
Button.ImageColor3 = magic.Value == true and Color3.fromRGB(85, 255, 127) or Color3.fromRGB(255, 255, 0)
end
elseif Button:IsA("TextLabel") and Button.Name ~= "Element" then
if Button.Text ~= "LOCKED" then
Button.Text = magic.Value == true and "SELECT" or "SELECTED"
end
end
end
end