At least four people were killed and seven wounded when suspected Islamic State fighters attacked a town in central Libya, a military official and lawmaker said.