Your answer would be 24, so you got it right.
This is because you need to find the lowest common multiple of 6 and 8, that is, the lowest number that divides by both 6 and 8.
We can do this by either writing out the multiples of 6 and 8 until you find a common one, or you can find the prime factors of 6 and 8 and multiply them:
6-> 3 × 2
8-> 2 × (4)->2 × 2
So we would need to do 3 × 2 × 2 × 2 = 3 × 8 = 24
I hope this helps!