How to not overuse if statement?

Thank you, that helped me a lot!

Use module scripts to configure and loop through them. Here’s a post of mine in which I explained the method in detail

It was used to explain stuff in a different topic so just look at the examples I provided.

1 Like

Hmm interesting, ima try it out. Any thoughts on how could I do that on a skill tree?

You could store the values in table on a server script for that, something like:

Initializing the table

local SkillTrees = {}

  SkillTrees[player] = CharacterSkillTree -- set whatever value the player skill tree is

Make a module for all the skill tree values
Creating a config module

local module = {
 ['SKILL 1'] = {
  ['Name'] = 'Some Skill 1'
  ['Stats'] = -- stats idk


return module

And then in a server script, you could do
Evaluating the player

local skillModule = require(pathtoModule)

for i, v in pairs(skillModule) do
  if SkillTrees[player] == v['Name'] then
      -- code that does something

Hope this helps.

1 Like