One method that doesn't require a script, is to enable the "allow creation of records via the relationship" option for your relationship and then put a portal to address on your projects layout. You can then simply enter data in the blank fields of the portal and the Project ID value will be entered for you by filemaker. You can also define looked up values that copy data from one table to another once the Project ID value is entered.
However, this all looks a bit backward to me. Couldn't one address link to several projects? (Maybe not if these are construction projects of something.)
If so, I'd have an addressID serial number in Address and a matching number field in projects and link address records to projects by entering an addressID from the address table into an addressID field in projects.
PS. your script doesn't work because you can't refer to Projects::Project ID from the address layout as you haven't yet assigned a value to address::project id. You'd have to store Project ID in a variable before changing layouts and making a new record.