Client-Sided VFX

  1. What do you want to achieve? Keep it simple and clear!
    Make Client-Sided VFX in a clean way and not much complicated

  2. What is the issue? Include screenshots / videos if possible!
    I Have questions on
    1:How?
    2:Where should i store that bunch of local scripts, remotes and VFXs

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Yes but i didnt got enough answers.

2 Likes

What I did to make client sided vfx replicated on the server is do the vfx twice. Once on the client and other on the server. I name the server vfx the name of the player and using a local script destroy them. Now it plays on the client without lag and on the server.

You can put scripts in starter character scripts or starter player scripts or starter gui. Remote events belong in replicated storage and scripts in server script service.

If you do not want replication then just don’t?

dang, i didnt understand the part that you created double vfx and then destroyed or smthing like that :sweat_smile:

ooohhh i get it, so you delete the server vfx from local script, so that the server script can do his work like: damaging players and etc right?

My usual hierarchy:

  1. A Script containing the server-sided logic, which would include:

    • Validating the requests sent by the client
    • Sending the validated incoming events to other nearby clients
  2. A LocalScript containing the logic for the client that is trying to enact the VFX, e.g. some tool that tries to shoot a laser beam

  3. Another LocalScript that handles incoming replication events, i.e. the sword-related effects that other clients may be performing

  4. A ModuleScript containing the VFX behaviour, e.g. ‘spawn part here at n time, then play particles at x rate for t seconds’

Then:

  1. The client, through the aforementioned LocalScript, activates some input action - e.g. tries to swing a sword and starts playing the animation

    • The client informs the server it has started this action via a RemoteEvent
    • This client plays the associated VFX ModuleScript itself
    • When a client thinks it’s damaged someone, such as during the sword swing, it sends that information to the server
  2. The server, through the Script, awaits events from the client and validates them:

    • If the client informs them it has started some action, e.g. the sword swing, it checks to see if that’s valid and then subsequently sends that information to nearby players after sanitation
    • If the client requests to damage someone it will perform further validation to confirm, with at least some certainty, that this was actually possible
  3. The nearby clients that receive this information, via its replication-related LocalScript, awaits events from the server:

    • When it receives an event to play XYZ effect, it will look up the associated ModuleScript and attempt to play that effect
4 Likes

Yes exactly.

1 Like

tysm for the help, now i know how to make vfx on the client like a pro now :slight_smile:

You can have ClientEffectModules that run the actual effect presets, and fire a RemoteEvent to the client similar to:

ClientEffectModule:FireAllClients('ModuleName', 'Func', Params)

For individual particle or sounds, you could write an FX utility handler and do something like

FXUtil:FireAllClients('SFX', {
    Sound = Assets.CoolSound,
    Parent = Character.PrimaryPart,
    PlayOnRemove = true
})
1 Like

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