Ability system help

Hello everyone,

in my game i am making an abilities system, such as the one in forsaken. I dont want anybody to make me a whole system or anything, i just want to know how i would go about this, as i am very confused, what scripts should i use, and i know if i write it myself it would be insanely unoptimised and difficult to adjust or read, and it would likely be a pain for me to write, more so than some of your suggestions.

Thanks in advance! :slight_smile:

1 Like
  1. Client actives the ability on client.
  2. Server receives the request to use the ability
  3. Server validates all the stuff it needs
  4. Server executes server-sided execution of the ability (handling damage, etc)
  5. Then tells each client in the game to active VFX module.

Hierarchy:

ReplicatedStorage
   Modules
      Abilities
        Ability1 (ModuleScript)
      VFX
        Ability1
          VFXPart
ServerScriptService
   Modules
       Abilities
         Ability1 (ModuleScript) 

example

Use.OnServerEvent:Connect(plr: Player, ability: string)
    local playerData = 
    local abilityData = abilities[ability]

    if not abilityData then
        return
    end
    
    if playerData.level < abilityData.level then
        return
    end
    
    if playerData.flags.onCooldown then
        return
    end
    
    local Skill = ServerScriptService.Abilities:FindFirstChild(ability)
    if not Skill then
        return
    end
    
    playerData.flags.onCooldown = true

    for _, Player: Player in next, Players do
        Use:FireClient(Player, ability) 
    end

    local ActiveSkill = Skill.execute(plr)
    
    ActiveSkill.ended(function()
        playerData.flags.onCooldown = false
    end)
end)

The Skill.execute would perhaps create some lets say spikes (on server) and put them in a new folder for that ability .

When client is told to do VFX, you can lookup for the new part inside the folder

1 Like

Would i have a centralised server script in server script service to access those modules?
Also in the module scripts would i have a module for each character, or each ability, as for the character i could have one function for each ability, named the keybind, such as E or F or Q.

client you do how you like, keybinds, hotbar, whatever you want, i just gave you an example of the actual ability execution

Yes i know, i was just wondering if i have selectabele characters, would it be better to have a module script for each character or each ability

yes, the characters and abilities should be in a modulescript

yes, in order to access character and ability data it has to be module script

I know, i am wondering the amount of modules. Lets say i have two characters, who have 3 abilities each. Should i make 6 module scripts, so 1 for each ability, or 2 modules, so one for each character, and those have all the abilities for that character.

what no wth, i just told u each server execution and client of the ability is completely seperated
you hold data in modulescripts, seperate abilities and characters

Sorry, i’ve never used module scripts, if u think im dumb, idc. All the data i need i can access in server and client scripts already, so is there a need for module scripts?
(Sorry if this is a stupid question :sad_but_relieved_face:)
I am just thinking the server script would get very messy if i kept saying

if plr.GameTeam.Value == "Character1" then
   print("doing ability")
elseif plr.GameTeam.Value == "Character2" then
   print("doing other ability")
end

its completely possible to use a module script for each ability, but make sure you know what you’re doing and to organize them properly. However, judging by what I’ve read it seems that you’re kinda new to developing. I wouldn’t really advice taking this approach if you’re new.

I’d advice using 2 module scripts for now, 1 for attacks and 1 for the characters

1 Like

Yeah, im relatively new, started in Januaryish, but i just put off using modules, thought i didn’t need them and they were too complicated. Now i see otherwise, they’re quite useful. Thanks all of u for the help!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.