I had another line of code that was interfering with it working. The last thing I would like to do is use the value from a text field box in the script to generate the number, but I might be going about it wrong.
var myComp = app.project.activeItem;
var myLayers = myComp.selectedLayers[0];
var myIndex = edittext1.value;
myParent = myLayers.effect("Parent Me")("Select Parent");
myParent.setValue(myIndex);