The projectile is a fireball and the idea is to create a table of enemies that are already hit, make sure the enemy is not in the table and damage them and add them to the table if they are hit.

local alreadyHit = {}
ball.Touched:Connect(function(hit)
	if hit.Parent and hit.Parent ~= char then
		if not isInTable(alreadyHit, hit.Parent) then
			touch.burn(hit.Parent, assets:FindFirstChild("PurpleFlameParticles"):Clone(), 1.5, .5)
			alreadyHit[#alreadyHit + 1] = hit.Parent
					
		end
	end
end)

Here is the isInTable function:

function isInTable(tableValue, toFind)
	local found = false
	for _,v in pairs(tableValue) do
		if v == toFind then
			found = true
            break;
		end
	end
	return found
end

Any help is greatly appreciated!

1 comment

0

Touched events are weird. Try adding a debounce.