Introduction:
Back when I was new to scripting. I struggled to make a good hit effect actually brings an impactful feeling. So I decided to make this simple ModuleScript and a short tutorial that will hopefully handle some of the VFX parts for you in just around 5 minutes! If you play around with this ModuleScript right you can get some actual good results:
Installation:
The ModuleScript is available here
*Remember to put the ModuleScript somewhere in the ReplicatedStorage as it’s the best place for replication and networking!
Let’s start by making a reference that represents the ModuleScript:
local HIT_EFFECT_HANDLER = require(script.HitEffectHandler)
Let’s make a good hit effect!
Before we start scripting, so you will need a special mesh part that looks something like this!
And also a ParticleEmitter that looks like this!
Psst. if you don’t have any of these, no worries I got you ! Click here for the mesh and here for the ParticleEmitter.
Alright, let’s start scripting!
Mesh Explosion Effect
I’ve written a sample code right here make sure to read the comments next to every line!
local HIT_EFFECT_HANDLER = require(script.HitEffectHandler)
local MeshEffect = HIT_EFFECT_HANDLER.new(
enemy.HumanoidRootPart, --Target
game.ServerStorage.Effects.Mesh, --Your special mesh part
0.25, --Duration
6 -- Spawn Rate
)
MeshEffect:MeshExplode() --Play the explosion!
Check out the cool result!
Particles Effect
local HIT_EFFECT_HANDLER = require(script.HitEffectHandler)
local ParticlesEffect = HIT_EFFECT_HANDLER.new(
enemy.HumanoidRootPart, --Target
game.ServerStorage.Effects.Particles, --Your special mesh part
1, --Duration (How long will the particles last?)
1 -- Spawn Rate
)
ParticlesEffect:GenerateParticles() --Play the particles effect!
Check out the cool result!
Let’s combine the mesh explosion effect and the particles effect together!
And there you have it, a decent hit effect!
Make sure to play around with it and be creative! The result won’t disappoint you!
P.S If you need any help or feedback make sure to leave a comment so I can check it out later.