How to prevent client side VFX from breaking when character dies?

I’m trying to build a VFX system where only the clients see the VFX and not the server to prevent lag and enable the smoothness of the VFX. It works exactly like this video:

However what this video doesn’t show is that if you were to die or reset your character, the effect would break and the VFX would simply freeze in the workspace forever.

There are similar posts about this problem but the solutions are to either delete the VFX on death or make the VFX server-sided. Deleting the VFX on death isn’t good as the VFX would just be deleted when it should still be active. Making it on the server would just cause stuttering with the VFX for clients and potentially lag the server.

I’ve seen some footage of games where the VFX is really smooth and even after the player dies the VFX still continues like normal as if it’s being all controlled by the server.

The issue may be because the client sided script is placed in starterpack, try placing it in starterplayerscripts

1 Like

you can delete vfx if you know how long it exists. if its a meshpart youre tweening you can connect destroy to tween.Completed and if its a particle you can delete it some time after your particles disappeared, if youre using :Emit() its really easy to just look at particle lifetimes

if youre doing player vfx with attachments, place it in StarterCharacterScripts, the code should re-run. If you run the vfx from a module, make a function SetupPlayer where you re-clone the vfx and attachments from an asset folder, then run it when player respawns

game.Players.localplayer.CharacterAdded:Connect(function(character)
	vfxModule.SetupPlayer()
end)

Damn you were right. I didn’t even know the difference between them.

From now on dont put any scripts for vfx inside of startergui and starterpack, use only starterplayer.

Anything put in StarterCharacterScripts will end up parented inside the players character upon spawning.

Anything put in StarterPlayerScripts will end up parented to the player scripts inside of the player inside of players service and so since this doesnt reset when the character dies, the vfx does not reset either.