So as you may know this isn’t a commonly discussed topic. I’ve watched YouTube videos on how to make a Skill Tree, looked up some tutorials on devforum, but most don’t answer my own questions which are:
How should I structure my skill tree?
How should I script buying & giving skills?
Which parts should be client side, and which parts should be server side?
How do I check if the player has not bought a skill before buying the next one?
So for the first question, I want to know the basic structure. Like what do most people usually do when they make a Skill Tree.
The second question I just want to know what kind of systems I could use for buying, and giving a player a skill once bought.
The third question is a pretty self explanatory question. I just want to know how I should optimize my scripts so exploiters can’t abuse this, and it works.
The fourth question is like this. So say I have a power, speed, and health skill tree. How would I make it so the player has to buy the first power upgrade before buying the next one? There are some straightforward answers to this, like adding in more values in a player or to a player but that could add a lot of mess to my code. Especially since I’d need a value for every skill the player can get.
I would start by designing the UI for the client first and highly recommend making something that is scalable so you can keep adding onto it. After that I would program the client so once they have enough currency, experience, etc they can click to unlock and fire the server with their request and validate it there. After validating the unlock you can send back if it was successful and provide a message if they unlocked it or not and on the server I would update their datastores with the new skill they unlocked.
Upon a player joining you can just load their datastore, fire a remote to the client and load in all their current unlocked skills.
Thanks for your help, to make this more brief and easier to understand so I can look back on this someday I’ll just create my own explanation of how I’m going to do this:
Add Buttons for your skills
When you click on each button, you fire the server with the name of the skill.
You want to check a table for the skill’s name
Check if the player has enough points to buy this
Give the player what they bought, and subtract the players points by the cost
Return the purchase to the client, for visuals like making the button light up if it’s purchased.
I know there’s probably more efficient ways to do this, but this is the best method I could think up and it’s my first attempt at making a Skill Tree. This is my plan, and I’m seeing it through. Thank you guys for your help!