g_health_bar_list = {} g_health_bar_red = {} function health_bar_red_init(e) GravityOff(e) end function AI_Attach_health_bar (character) if g_health_bar_list[character] == nil then g_health_bar_list[character] = {green = nil, red = nil} end end function health_bar_red_main(e) local HB = g_health_bar_red[e] if HB == nil then g_health_bar_red[e] = {character = nil, x = 0, y = 0, z = 0} HB = g_health_bar_red[e] end if HB.character == nil then for k, _ in pairs (g_health_bar_list) do if g_health_bar_list[k].red == nil then g_health_bar_list[k].red = e HB.character = k break end end end if HB.character ~= nil then local Ent = g_Entity[HB.character] SetPosition(e, Ent.x, Ent.y + 100, Ent.z) Scale (e, 100 - Ent.health) RotateToCamera(e) end end