Particles won't load sometimes?

It’s a little hard to explain, but whenever I want my blood splatter to play it does but there’s that rare chance that only the sound would play with no blood splatter

Here’s what I mean:

Particle segment of script:

Hitbox.OnHit:Connect(function(hit, humanoid)
			if humanoid.Parent ~= script.Parent.Parent then		
				if hit.Parent:IsA("Tool") then return end
				humanoid:TakeDamage(Properties.Damage)
				
				local SFXList = script:WaitForChild("FleshHit"):GetChildren()
				local RandomSFX = SFXList[math.random(1, #SFXList)]
				local SFXClone = RandomSFX:Clone()
				SFXClone.Parent = hit
				SFXClone:Play()
				delay(SFXClone.TimeLength, function()
					SFXClone:Destroy()
				end)

				local Blood = game:GetService("ReplicatedStorage").Miscs.BloodVFX.Normal:GetChildren()
				for i = 1, #Blood do
					local BloodClone = Blood[i]:Clone()
					BloodClone.Parent = hit
					BloodClone.Enabled = true
					delay(.01, function()
						BloodClone.Enabled = false
						task.wait(1)
						BloodClone:Destroy()
					end)
				end	
			end
		end)

Move BloodClone.Enabled = false after task.wait(1)

If that doesn’t work, this runs both the sound and the blood spatter at the same time.

Hitbox.OnHit:Connect(function(hit, humanoid)
    if humanoid.Parent ~= script.Parent.Parent then
        if hit.Parent:IsA("Tool") then return end
        humanoid:TakeDamage(Properties.Damage)
        
        local SFXList = script:WaitForChild("FleshHit"):GetChildren()
        local RandomSFX = SFXList[math.random(1, #SFXList)]
        local SFXClone = RandomSFX:Clone()
        SFXClone.Parent = hit
        SFXClone:Play()

        local Blood = game:GetService("ReplicatedStorage").Miscs.BloodVFX.Normal:GetChildren()
        for i = 1, #Blood do
            local BloodClone = Blood[i]:Clone()
            BloodClone.Parent = hit
            BloodClone.Enabled = true
            delay(0.01, function() -- adjusted delay time, might be too low; further troubleshooting is setting this to 0.1
                BloodClone.Enabled = false
                task.wait(SFXClone.TimeLength) -- wait for the sound effect to finish
                BloodClone:Destroy()
            end)
        end
        delay(SFXClone.TimeLength, function() -- delay the destruction of the sound effect clone
            SFXClone:Destroy()
        end)
    end
end)
1 Like

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