I*m trying to make a spell system in UE5

Look into the gameplay ability system(GAS). You can combine a widget system, to set abilities for input values. Example, say you have 1,2 and 3 set for abilities. Each of those abilities can call an “ability slot”. Each ability slot can then call another ability(spell) that is set by the player or depending on the character they choose. It’s a decent bit of work, but if you look up Alamars Dev Domain on YouTube, he’s got some good tutorials on setting it up though c++ and implementing it in BP.