My game has several spells and action bar has 10 slots for players put spells.
The problem is that I'm not getting that each button to detect the magic that it.
Develop games in your browser. Powerful, performant & highly capable.
You have to use ids for each spell and link the spell id to each button.