Correct way of scripting VFX?

So im currently scripting some VFX abilities in my new game and im not sure which is the “correct” way to script this. By correct I mean not so vulnerable to exploiters and also lag efficient for the server. So i’m currently using tweens and networkownerships to animate my VFX and im not sure if using BodyGyros/Positions would be a better alternative for the VFX. Any help would be appreciated!

VFX Designer here. What are you constituting as “VFX”? Meshes, particles?

Using tweens and networkownership is probably for meshes.

Yeah so heres what I mean


Screenshot 2023-06-26 133634

How would I animate something like this?

1 Like

Client-side using tween service, lerps, etc.
You don’t want to animate this on the server as your visuals will look choppy and lag other players.

It’s unlikely that exploiters will abuse this, may as well not even use particle effects because everything can be abused or used to lag a game really.

Just design your remote events so exploiters can’t spam-fire them.

2 Likes

But if I use client side tweening this would’nt replicate to the server so others will not be able to see this

you can use FireAllClients to tell the clients what skill and where the skill will be rendered, and set the hitbox on the server

1 Like

It’s not supposed to replicate.

You spawn a local and personal effect for every client.
The server simply tells all clients 'spawn X effect at Y location", simple as that.

Don’t replicate the effect itself, it’s slow and laggy.
Just tell every client to spawn it at the same location, completely client-side.

But my game is like a PVP type game. It has battles and stuff. So for the animations/ effects not to take place then the ability would look awkward and not seem so good.

I feel like there would be a more efficient way rather then having to fire to all clients everytime a animation happens. Correct me if im wrong

perhaps, if so I’d like to know as well.
generally sending minimal amount of data wouldn’t be a big deal even if its being used multiple times

event:Connect(function()
	if keyframe == "1" then
		FireAllClients(skillName, 1)
	elseif keyframe == "2" then
		FireAllClients(skillName, 2)
	end
end)
1 Like

I think you misunderstood them:

  • Client tells server where to use effect
  • Server tells all clients where to use effect. Make sure to run sanity checks here (i.e. checking if the move can be used properly here) before firing to all clients.
  • All clients render the effect locally at the specified location

This method is probably the most practical way to go about this, as it minimises lag and renders the effect locally too.

Thanks, ill try using this and see how it goes thank you

Thanks for letting me know ill try this out

Let’s say you throw a grenade in a shooter game.

The server sees the object fly through the air and roll over the ground.
When it explodes, the server checks which players are hit while sending a signal to all client “animate explosion with sound here”.

It does not have to be perfectly synchronized (and it never will be), the smoke particles do not have to be the same for every client.
All that matters is players seeing an explosion and hearing the sound at the location of the grenade.

And maybe your grenade is a magic grenade with animated particles and expanding rings, etc.

Even if you did it server-side, the animation will never be fully synchronized and will be 0.1 second off for every player.
What matters most is that players know “a grenade exploded there”.

But would you rather have a choppy animation that lags the entire server or make all effects local/client-sided so save on bandwidth AND also make things like graphics/quality settings possible?

Wow I get what you mean now thanks for the reply!

1 Like

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