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)