Handling Visual/Cosmetic Effects

Would it be better in terms of reducing strain on the server/reducing overall ping to simply handle all effects on the client?

For example, when I use a skill that triggers are “slash” effect onto a character, would it be better to make that effect on the server, or would it be better to do it on the client?
(Essentially, what I’m asking is if it’s not too rough on the server to fire events this often)

If I were to use the second version, it would be something like this:

function skill.fire()
    -- whatever code before this
    part.Touched:Connect(function(hit)
        local humanoid = --whatever way to get humanoid
        effects:FireAllClients(associatedModuleForEffects, humanoid.Parent)
   end)
end

-- On client
effects.OnClientEvent:Connect(function(module, ...)
    -- maybe do a distance check before-hand?
    require(module).fire(...)
end)

Would this method be better than simply handling all effects on the server? Like maybe I’d want to emit some particles, use tweenservice on the size and position of a meshpart to achieve an effect, etc.

It would be better handled on the client, especially if you have many of these slash effects (and presumably others) going on at the same time. It also gives you some more control over these effects, for example making certain clients (like the attacker) have more special fx drawn up for them.

3 Likes

Long story short, Do it on the client.

When doing it on the server, it has to do the following extra:

  • Replicate the data to the client
  • Making sure the client received the data
  • Handling the data on the server while providing the image to the client

Hope that helps.

7 Likes