How would I make this BackgroundColor3
script apply to all children?
I have tried to do it.. and failed. Currently it only works for a Child it finds named "Store"
How would I re-code it so that it applies to all children?
Any help is greatly appreciated!
Here is the coding:
for i,v in pairs(script.Parent:GetChildren()) do if v.Name ~= "Script" then if v.Name == "Store" then v.MouseEnter:connect(function() v.BackgroundColor3 = Color3.new(255,0,0) end) end end end
I'm probably the worst person you should take advice from but you could iterate through all children with a for loop and getchildren() and match it with certain properties and then change the backgroundcolor3 of all of children that were achieved from the for loop/getchildren() and set it.
for __, obj in next, (script.Parent:GetChildren()) do if obj:IsA('GuiObject') then obj.MouseEnter:connect(function() v.BackgroundColor3 = Color3.fromRGB(255,0,0) -- or Color3.new(255/255,0/255,0/255) end) end end
:: Run from a local script