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.
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
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.
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 )
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
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!