I have this fireball script that puts itself into the fireball projectile when shot on another script how would i limit this to hit multiple people?

wait(.025)
local radius = 13 -- in studs
local par = script.Parent
local explosion = script:WaitForChild('Explosion')
local debounce = false
local hitbounce = false

function hit()
	local brix = Instance.new('Part', workspace:WaitForChild('Debris'):WaitForChild('AoE'))
	brix.CanCollide = false
	brix.Anchored = true
	brix.Transparency = 1
	brix.Shape = 'Ball'
	brix.Name = 'AoE'
	brix.Size = Vector3.new(radius,radius,radius)
	brix.CFrame = par.CFrame
	local ex = explosion:Clone()
	ex.Parent = brix
	ex:Play()
	local kaboom = Instance.new('Explosion', brix)
	kaboom.BlastPressure = 0
	kaboom.Position = brix.Position
	par:Destroy()
	brix.Touched:connect(function(part)
	 	if hitbounce == false and part.Parent:FindFirstChild('Humanoid') and part.CanCollide == true then
			hitbounce = true
			local human = part.Parent:FindFirstChild('Humanoid')
			human:TakeDamage(65)
		end
	end)
	wait(ex.TimeLength)
	brix:Destroy()
end

par.Touched:connect(function(part)
	if part.Parent:FindFirstChild('Humanoid') and debounce == false and part.CanCollide == true then
		hit()
		elseif debounce == false and part.CanCollide == true then
		debounce = true
		hit()
	end
end)

wait(2)
par:Destroy()

2 comments

0

You should not create a new script for every fireball lol

0

aw