Spell casting system?

Ok so im making a mmorpg kalled “The legion” were you are a apprentice wizard and i need a spell casting script for it and i’ve tried alot of scripts but none of them seem to work!
The person who helps me gets credit in the game!

this is kind of a comment just to organize the pseudocode i made it an answer. just to give u an idea on how u could do it

u just need to call the animation of the spell casted, and after some seconds send the spell. theres not much to it. or it depends on how u do it.

WOW logic:

    onclic fireball{
    // cast fireball animation on.
    // after 3 sec
    }else{"cant do that moving"}

at fireball() call the animation of fireball spell then it just takes the positions of the player and its target and sends the ball to follow its destiny