A 6 year old child who is properly hydrated should be able to go 2 to 4 hours without peeing.
However if the 6 year old child needs to pee then they should be allowed to go pee and not have to hold the pee in.
Holding in pee too long can cause bladder infections, Urinary Tract Infections etc.
So if your child needs to pee you need to allow them to pee when needed and if the child is too busy playing and they start squirming and showing signs they need to pee then remind them that they need to get up to go to the bathroom.
I remember when my son was 6 he would be sitting there watching TV and would start squirming and sometimes he would pee his pants.
I told him that he needed to go pee or he would have to start wearing diapers again.
So he peed his pants again and I put him back in diapers and had him wear them for a week and then he decided that he wanted to use the toilet again.
If your 6 year old is not needing to pee within 4 hours then they are likely dehydrated.