Create a script inheriting from resource.
Put any variables you want in the script, but only use built-in types.
Only variables with the export tag will be saved.
You can initialize the variables by overriding the _init() function.
Give your resource script a class name at the top of the script.
In a separate script, declare a variable using the resource class name as the type.
Create the resource using the class name followed by .new().
Save the resource using ResourceSaver.save(_var_name, "user://filename.res")
Load the resource using _var_name = ResourceLoader.load("user://filename.res")
Be sure to set the variables inside the resource before saving, and get their values after loading.