If you post your script, it would make it a lot easier to help you out.

Have you set both the Stop and Trail variables? They are both required for TrailLock.