HUD.Health.Tray.Beat.Line1.BackgroundColor3 = (
(Humanoid.Health > 200 / 3) and Color3.fromRGB(0,255,0) or
(Humanoid.Health <= 200 / 3 and Humanoid.Health > 100 / 3) and Color3.fromRGB(255,255,0) or
(Humanoid.Health <= 100 / 3) and Color3.fromRGB(170,0,0)
)
I want all the children of Beat to do this, I've already tried
for i,v in pairs(script.HealthGui.HUD.Health.Tray.Beat:GetChildren()) do
if v:IsA("Frame") then
v.BackgroundColor3 = (
(Humanoid.Health > 200 / 3) and Color3.fromRGB(0,255,0) or
(Humanoid.Health <= 200 / 3 and Humanoid.Health > 100 / 3) and Color3.fromRGB(255,255,0) or
(Humanoid.Health <= 100 / 3) and Color3.fromRGB(170,0,0)
)

4 comments
Do you need to calculate this each time or can you just use the same value for all of the frames?
Same value
Then just do the logic once then pass the same Color3 object to all of the frames in the loop
Answer edited.