Spamming the space button with autohotkey, that sounds like what is used on some game sites to automate things, like rapid fire using the space key.
If you are hosting an online game I think you could have macros activated by hot-keys on the site. That could work like AHK does even for those on a moblie or non Windows, if that is your idea.
Like @SamA74 suggests it would be best done client-side, if done server-side I think you might have trouble with delays in the respons from the server on client side actions like pressing/not pressing a button. Or maybe not. I’m not a gamer and I’m just guessing.
You need to describe in more detail what the goal of your idea is, what the result should be when it goes on.