save state of script

If there is something in Creator Kit that you can extract, by all means, give it a whirl.

Otherwise, there are plenty of loading / saving tutorials out there on Youtube to start with.

Load/Save steps:

Don’t use the binary formatter/serializer: it is insecure, it cannot be made secure, and it makes debugging very difficult, plus it actually will NOT prevent people from modifying your save data on their computers.