Mod edit:
Topic starter thought is necessary to remove the content of his posts.
For reference, his initial script kept looping its output even after releasing the triggering key and some posts were:Sorry guys! I don't know what to do. This script keeps getting stuck on an infinite loop and I really can't fix this.

Sometimes it gets stuck in the loop after I release the key and continuously sends the hotkeys until I press the key 1 again or reload the script.

The faster it is, the better the performance in the game. I have tested it several times and the script needs to be very fast. The script I'm using, has the speed I need. But it keeps getting stuck in an infinite loop.

Anyway, thank you very much!
Nextron, I guess that you found the problem man!

removed your basic loop and replaced them with a while loop so the code is optimized. tested and working on my system. Also you should use SendInput instead of send as it is faster. i get that by setting SendMode to input that you are using SendInput by writing Send, but in case that sendMode isn't loaded correct you have issues

an even better version would be where you can toggle it on and off and i've attached it below, i would recommend that you play with the single delay as it is CPU intensive as you are sending about 4000 characters a second if all is activated

But with your script, the only way to stop the loop is pressing scrolllock. And like I said, I'm using this script for gaming. And this way isn't viable to play a MMORPG. The best way is when I "release" the key and stops the loop.

well i've given you two versions of the same script, from here if you mix them with a WHILE for each key as in the first script with the loop in the second, you will be able to do what you want. Or you could just nest the while loops

Just in case you still cant figure it out
By using ~ in front it allows for the key to be used as the normal key while also triggering the hotkey
Using ~ also imply $ by default so you don't need to add $~ to be able to send the same key that you are using for hotkey, in the script
as 3 is not sent by it's own hotkey i just use the normal 3 as hotkey without any operators in front of it
you could also change the outer while loop for each key to an IF statement for the ScrollLock, this way this test will only be run when you hit the hotkey. This way it's a bit more optimized (less check) but you won't be able to stop this script while you are holding one of the hotkeys.

With the below script you are able to stop the script by releasing either the hotkey or press ScrollLock while holding any of the hotkeys. if you change the outer while loop to an IF statement you will only be able to break the loop by releasing the hotkey

Well time for you to mix the scripts then, i'm on my way to bed, and I might have a look at it tomorrow, nothing is wrong with it, it's just not working as you expected, it might be time for you to really describe how you want it to work I've given you 3 different versions that all have their good and bad sides, and you can't get it all, compromises will always have to be made.

Thank you @geekgarage! I removed the key "1" and now it's working like a charm!

You are very welcome

I've optimized it a bit further and now you can also use the keys as normal keys when scroll lock isn't enabled (so you can write in in-game chat and such. Be aware that if you set the delay timer lower than 8 ms you can experience that it's not jumping out of the while loop due to the speed of GetKeyState (this is also an issue in the other versions of the script and any script that uses GetKeyState. Not only that but by changing the outer while to IF you can now repeat use hotkeys without having to disable scroll lock after first use, that was a mistake from my side, sry about that, but it is fixed now.
If you run it with lower delay than 8ms and you get that issue, by tapping one of the keys REALLY fast as that is the only way to trigger it, you just press the same key again and it stops, but by using the 8ms delay in the loop this should be gone and it would still represent a single key being pushed 125 times a second, and that is just ridiculous many keys, now with the hotkey 1 that sends 3 character that would be 375 keys a second!