How to reduce particle emitter delay

So I’m using ClientCast and when a player gets hit it will find the exact position returned by the raycast. I want to spawn some hit particles so I have a part → attachment → 4 particle emitters where the part would be set to the hitposition. I have looked up similar problems which said to use :clear() and emit for better responsiveness however, theres still about a 0.5 sec lag.

local function HitEffect(player : Player, HitPosition : Vector3)
	local CloneEffect = HitVFX:Clone()
	local CloneEffectLifeTime = 1.5
	local Weld = Instance.new("WeldConstraint")
	CloneEffect.Parent = workspace
	CloneEffect.Position = HitPosition
	
	for _, emitter in ipairs(CloneEffect.Main:GetChildren()) do
		emitter:Clear()
		emitter:Emit(100)
	end
	DS:AddItem(CloneEffect, CloneEffectLifeTime)
end

--Events
M1s.OnServerEvent:Connect(function(player, AttackName : StringValue)
	local AnimationSpeed = swordMastery(player)
	local Animation, AttackName:StringValue = m1animationLoader(player, AttackName)
	if Animation then
		Animation:Play()
		Animation:AdjustSpeed(1 + AnimationSpeed) 
		SlashEffect(player, AttackName)
		m1decreaseMS(player, AttackName)
	end
end)

M1damagehandler.OnServerEvent:Connect(function(player : Player, Damage : IntValue, Animation : StringValue, HitEnemy : Instance, HitPosition : Vector3)
	if Damage == DamageSanityCheck[Animation] then 
		local Humanoid = HitEnemy:FindFirstChild("Humanoid")
		Humanoid:TakeDamage(Damage)
		HitEffect(player, HitPosition)
	end
end)

I think it would be good to first check whether it’s the particles that are slow or your code that’s slow.

Since you’re talking about a delay of 0.5s, you should be able to check this with a print statement.

Do a print right when you enable the particles, then observe if particles appear instantly or only after 0.5s.

1 Like

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