I made this event that emits particles on the client (I do :FireAllClients() for this), and everything’s going through properly. However, it’s not emitting.
Here’s my code:
VFXEvent.OnClientEvent:Connect(function(vfxPart : BasePart, positionFinal : Vector3, duration : number)
if vfxPart and positionFinal and duration then
local part = vfxPart:Clone()
part.Anchored = true
part.Position = positionFinal
part.Transparency = 1
part.Parent = workspace
for i,v : ParticleEmitter in pairs(vfxPart:GetDescendants()) do
if v:IsA("ParticleEmitter") and v:GetAttribute("EmitCount") then
v:Emit(v:GetAttribute("EmitCount"))
print("Made it")
end
end
task.delay(duration, function()
part:Destroy()
end)
end
end)
I have verified through a print. The “Made it” print fires 6 times (6 particle emitters). Everything goes through perfectly fine and no errors or warnings
A common problem I see people have with particle emitters is that they are firing it too early. Try adding a task.wait([some time]) right before you fire or emit it.
check that v:GetAttribute(“EmitCount”) is truthy, check that particles are in the correct position, also check that the part doesnt get destroyed right after particles are emitted
Thanks for both you and @MinecoIII2 's reply, I tried both of your solutions, even delaying it a bit and checking that EmitCount is a true value, and the part stays 1.5 seconds which is enough time for it to emit the particles. How can I check that the particles are in the correct position? The attachment I have it in is already in the part’s center, so I was wondering how that would be an issue?
Edit: In addition to this, I even copied the part and pasted it, and then tested emitting the particles via a plugin. It emits directly on the part
Just tried this. I also tried rearranging the code into this, but it still doesn’t work. The print statements are going through, but it’s just not emitting.
VFXEvent.OnClientEvent:Connect(function(vfxPart : BasePart, positionFinal : Vector3, duration : number)
if vfxPart and positionFinal and duration then
local part = vfxPart:Clone()
part.Anchored = true
part.Position = positionFinal
part.Transparency = 1
part.Parent = workspace
for i,v : ParticleEmitter in pairs(vfxPart:GetDescendants()) do
if v:IsA("ParticleEmitter") then
if v:GetAttribute("EmitCount") then
-- print(v:GetAttribute("EmitCount"))
task.wait()
v:Emit(10)
print("Made it")
end
end
end
task.delay(duration, function()
part:Destroy()
end)
else
warn("Argument(s) missing!")
end
end)