It depends on what values you've selected.
I sometimes use a Value List called YesChecked, and it only has one value in it: Yes.
So in my code I can refer to it like this:
if [table::field = "Yes"] ....
Check boxes are simply formats for entering specific values into a field. If your value list specifies values of 1 or 0 for a check box formatted field, then you can test for values of 1 or 0 in the field and you can change the value of the field using set field just as you would any field that does not have a check box field formatted.
If you have a value list with values 1, 0, then
Set Field [ YourTable::Yourcheckboxfield ; 1 ]
will clear the check box for 0 and select the check box for 1.
But check boxes have a special ability, they allow you to build lists of values in the field separated by returns. If you have one check box for 0 and one for the value 1, then clicking both check boxes will enter both a 1 and a 0 with a return character separating them. The first value listed will be the first check box selected.
Thus, checking to see if a particular value is selected often requires using the filtervalues function:
If [ Not IsEmpty ( FilterValues ( YourTable::YourCheckboxField ; 1 ) ) ]
will detect if a 1 is entered into the field regardless of whether the check box for 0 is or is not selected.
And if you specify other values than 1 or 0 for your value list such as the following text: apple; orange ; kiwi, then clicking a check box would enter the associated text for one of those values into your field and you might use "kiwi" instead of the number 1 in the above examples.
If you want to use a script to select a check box without clearing other check box values you might use this script step:
Set Field [ YourTable::YourCheckboxFIeld ;
If ( IsEmpty ( Filtervalues ( YourTable::CheckBoxField ; "kiwi" ) ) ;
List ( YourTable::YourCheckboxField ; "kiwi" ) ; YourTable::yourCheckBoxField ) ]
(This will appear as a single line in the script editor. I've added some returns to make things easier to read.)
You may find that your understanding of how this works improves if you make a copy of your check box formatted field, place it next to the original copy and remove the check box formatting by returning it to "edit box" format. You can then click check boxes in the first field and then see the actual data being entered in the second.
IsEmpty, FilterValues, List and Set Field are all names that you can look up in FileMaker help if they are unfamiliar to you.