There is an error in your example script, the correct syntax for this event handler is will be like this:
on <level>:JOIN:<#[,#]>:{commands}If you want this message to be visible to all users join the channel, to then the code might look like this:
on *:JOIN:#:{
.msg $chan Welcome $nick to this channel.
}
If you need a restriction only for members with access
level 4 and higher, then like this:
on +4:JOIN:#channel:{
.msg $chan Welcome $nick to this channel.
}
You can find a more detailed description here ->
https://en.wikichip.org/wiki/mirc/access_levels