Listen to your error message, and analyze your code. You've just set global variable script to nil, and then called GetChildren on nil. Private modules are simply just modules that don't need to be present in your game to require them. Instead, you can require their asset id (implying they needed to be uploaded to ROBLOX first), and ROBLOX will import and execute all the code in the required module.
Security
The only reason you'd need code that resembles what you've provided, is if you want to protect your private module's source from being stolen. However, I'm not sure how relevant or reliable implementing something like that would be anymore, because I'm pretty sure ROBLOX changed some permissions when requiring something over their network. I would have to try a few things myself to give you up-to-date information on protecting a module's source code.
6 comments
Not COMPLETELY sure if this is true, but I think it's probably because you're using a ModuleScript instead of Script so therefore 'script' wouldn't work.
http://wiki.roblox.com/index.php?title=Private_module
OH, my bad. I didn't really take the time to really look at what you had on there. Since you have script = nil, that's probably why the script is giving a nil value. You can't get the children of a nil value.
I removed it, still getting the error.
I'm not sure then. Hopefully someone else might be able to help shed light on your predicament!
You realise you have to upload it to the roblox model catalog (can be copylocked) and are ONLY able to use it in ONLINE MODE? (Not in studio solo / server)