This is a server script. It's supposed to change the health bar gui of an enemy depending on it's humanoid health but the color of the bar won't change
local char = script.Parent.Parent.Parent.Parent.Humanoid
char.Changed:Connect(function()
local redzone = char.MaxHealth/4
if char.Health <= redzone then -- if in redzone then chage to red
script.Parent.Health.ImageColor3 = Color3.new(255,0,0) -- Gives me an error, "ImageColor3 is not a valid member of Script"
end
if char.Health > redzone then -- if not in redzone then stay or change to green
script.Parent.Health.ImageColor3 = Color3.new(41, 255, 119)
end
script.Parent.Health.Size = UDim2.new(char.Health/char.MaxHealth,0,0,15)
end)

1 comment
nvm i fixed it, i changed Color3.new() to Color3.fromRGB. I also put the script inside of the health gui