Creating visual-effects on the client; which approach should I take?

A game that I’ve been working on is on the brink of being released, but there are a few touchups that I need to address before doing so. This includes VFX. Which way should I go about this? I plan to make these effects on the client, but I’m not sure which approach I should take.

  • Keep the Player’s PlayerGui and PlayerScripts clean, and whenever a Visual Effect should happen, using a RemoteEvent (to pass details, such as the location that the VisualEffect should happen), clone a LocalScript into every client’s (or just one client, depending on the situation) PlayerGui, and then destroy the LocalScript after with RemoteEvents

  • Keep one LocalScript in the Player’s PlayerGui/PlayerScripts and grab the data using globals like game.Workspace or just workspace. This is unpreferred because it seems unreliable.

  • Any others that you’d like to add on

I’d like to hear how you guys would do it. Working client-sided has always been a touchy subject for me because I have no clue if the way I do it is the way I’m supposed to do it.

3 Likes

VFX on the client is always a good idea.

Personally, I put a script in StarterPlayerScripts (although a PlayerGui script would work too providing the Gui does not reset on spawn), which just listens to a few different events.
I always tween parts on the client (unless the location of a part has to be exact on the server) and run any big temporary graphic effects (such as explosions with particles, lightning effects etc) on the client.

I would also try to make your code as generalisable as possible, so you can just :fireallclients() once per effect and send any relevant information into the client. One example would be to create an “Explosion” effect, where the client just clones a pre-made effect from ReplicatedStorage and edits it with any other values you pass, such as duration and colour.

Another good advantage of running effects this way is you can give the player control over how detailed they see VFX, which is always a bonus for people with low-end devices.

7 Likes