Since you didn't tell us what you want this code to do, it's near impossible to check. Second, there uis avery easy way of checking if you are 'doing fine', or if your code works and does what you want, and that is to boldly go where no scripter has gone before: TEST IT.

PS: I will give you one tip: events never under any circumstance begin with a .on, they begin with on. You cannot silence them with a . You need haltdef for that.