Hello. I’ve been trying to make a simple GUI that checks the players badges. After starting to make each icon for each badge individually, I decided on making a shortcut placed in each icon to automatically find the color for each icon based on it’s text. In the script, I first start with getting a table of the children in Lighting, then I check if it’s class name is a Part (it’s a merge game lol) I then check if the icon’s text is equal to the part’s name. If all checks out, it simply changes it’s background color to the same color of the block. It’s not working at all, in fact even after writing print lines for each step, it doesn’t print anything. The GUI is enabled and the script is entirely local. What is the issue here?
icon = script.Parent
text = script.Parent.Text
player = game.Players.LocalPlayer
player.CharacterAdded:Wait()
print("player loaded")
for index, child in pairs (game.Lighting:GetChildren()) do
print("getting a table of lighting's children")
if child.ClassName == "Part" then
print("child is a part, moving on")
if child.Name == text then
print("child's name = the icon's text")
icon.BackgroundColor3 = child.Color
end
end
end