I want the frame to automatically change color from green to red instead of me manually changing it every time it gets hit. It doesn't work even though it still prints 'test' without running into any issues
green = 255
red = 0
local frameColor = script.Parent.HP.BillboardGui.Frame.BackgroundColor3
function onTouched(hit)
if hit.Name == 'Damage' then
green = green - 18
red = red + 18
script.Parent.Sound:Play()
frameColor = Color3.new((red), (green), 0)
print('test')
if red == 255 and green == 0 then
print('finished')
end
end
end

3 comments
http://wiki.roblox.com/index.php?title=Loops
Use a while true do loop to loop this forever, if that's what you want
turns out i was using a wrong way to change the frame color, thanks for the suggestions though :)