This looks like it's mostly a design question, so I'll try my best to give some basic ideas.
Personally, if you want the fireball's power to be determined by how experienced the player is with magic, I'd design it more like this:
- Player (player object, obviously)
- Magic (a stat that gets saved)
- Fireball (not a stat, unlocked automatically, damage increases as "Magic" increases)
- Thunder (not a stat, unlocked when "Magic" reaches level x)
etc. With this layout, only "Magic" needs to be saved and loaded, and the rest is handled based on its value.
But if you want each ability to have its own skill level (i.e. the more the player uses "Fireball", the better they get at it), then "Fireball" can be its own stat.
I can see that being useful for if you want "Fireball" to be succeeded by another "Fire" attack, but if that's what you have in mind, you could do it like this:
- Player
- Magic (stat)
- Fire (stat, player starts with "Fireball", when Fire reaches level 10 they unlock Volcano or whatever)
If you're confused by how you would code something like that, the wiki page walks you through how to get the basic setup done.
https://developer.roblox.com/en-us/articles/Data-store
Try making a basic datastore that sets and gets a number value for "Magic" (or whatever you choose to name your ability level).
When the player levels up, overwrite/save/set it. When the player joins the game, load/check/get it.
If you successfully get the "Magic" value, then you can choose what to do with it.
This is just pseudocode, but it should help you get some ideas:
magicLevel = magicData:GetAsync(userid);
if magicLevel > 5 then
end
magicLevel = magicData:GetAsync(userid);
local baseDamage = 5;
local damage = (baseDamage * magicLevel);
enemy.Health = enemy.Health - damage;
If this was helpful, please upvote the answer or mark it as the solution, but if you have more questions, leave a comment :)