Should I use a client or server script for this feature?

So i am making an ‘ability’ feature for weapons that I’m making in my game that makes them do a unique set of movements that deals damage to other players/NPCs in unique ways.

I’m also adding effects to the abilities to make them stand out more.

But here’s the question, someone had been recommending to me that I should script the ability in client but I’ll need to use a server script for at least some of its features so that the abilities can have an effect on other players (e.g. damaging players doesn’t work on client script).

Should I exclusively use a server script or both a client and a server script for different parts of the ability function? What parts of the ability should be scripted in a client script and what parts on a server script?

For each ability, ill need to add these set of features:

  • An animation and sound FX (doesn’t affect gameplay but visible to everyone).
  • Potentially some movements that affects the players’ gameplay.
  • Visual effects for the ability to add ‘character’ to an ability however it an also be used as a AOE where it would affect the player if it in contact within the area of the visual effect. I could separate the visual effects from the hitbox but adding both would be unnecessary hard work.
  • A damaging/character effect system that triggers when an ability’s range/area gets in contact with a player’s hitbox, (can use a script or a part to detect this) and affects the character when hit by the ability.

Thank you

1 Like

For hitbox server-side is necessary. You can go with server until you end up with some lag then you must decide what you be forced to move to client.

Is it better to future proof for adding code to the client just in case the abilities might get too laggy when activated?

At the moment since the game is still simple so there’s not much lag but who knows what we might add in the future

I like to build first optimize later. If you got the knowledge of something that really benefit to run on client, do it on client. The problem I see is the complexity of managing client and server code. Having mostly server code is easier to maintain.

nvm there are parts of the scripts in which i must use a client script (e.g. raycasting)