Should weapon trails be handled on the server or client?

I am making a weapon system that has a trail that activates every time that you swing and deactivates when you aren’t swinging.

I have heard that visual effects should always be handled on the client, but if I have around 20 people playing in a server, swinging about twice per second, that would be a LOT of remoteevents firing every second. Firing to turn on the trail for every client as well as firing to turn off the trail.

So it seems that I have 2 options:

  1. on the swinging player’s client, I fire a remoteevent to a serverscript. That serverscript will then fire all clients to turn on/off the trail.

  2. on the swinging player’s client, I fire a remotevent to a serverscript that simply turns on/off the trail

I am currently using the first option to handle visual effects for abilities, but because swinging weapons happens at a much faster rate than abilities, I am worried that there will be issues.

Which should I do?

1 Like

It’s more performance efficient to go with the second method. Everything that the server affects is automatically replicated to all clients. You’re just creating unnecessary steps with the first method by getting every client to activate/deactivate the trail themselves.

2 Likes

Your weapons shouldn’t be coded using a local script in the first place because if it needs to access something on the server it would need to fire remoteFunctions.

As someone who has already made sword combos (Image below), I always use scripts as they function much better and make interaction with the environment much easier to code. I recommend you rewrite your code so it functions in a normal script rather than a local one.

This was coded entirely using a server sided script.

2 Likes

I am doing hit registration on a local script, as hit registration feels very clunky if done on the server. Should I not do this?

1 Like

Absolutely not. Only the server should check for hits, and there are many extremely advanced modules made by the community to ease your life.

You can look up over there: Community Resources - Developer Forum | Roblox
But personally my team is using Raycast hitbox, which is perfectly suited for server side checks

1 Like

I am also using raycasthitbox, but when testing hitstart:() on serverscripts there seems to be a big delay.

1 Like

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