local function j(Z)if Z and Z~=Workspace then local h=Z:FindFirstChild("\072\117\109\097\110\111\105\100")if h then return Z,h else return j(Z.Parent)end end return nil end local function Z(Z)if Z then local h,n=j(Z.Parent)if n and n.Health>0 then(CreatorTag:Clone()).Parent=n n:TakeDamage(100)end end end local function h(j)if Rocket and j then if IGNORE_LIST[string.lower(j.Name)]then return end local h=CreatorTag.Value if h and(h.Character and h.Character:IsAncestorOf(j))then return end Z(hitPart)local n=Instance.new("\069\120\112\108\111\115\105\111\110")n.BlastPressure=BLAST_PRESSURE n.BlastRadius=BLAST_RADIUS n.Position=Rocket.Position n.Hit:connect(Z)n.Parent=Workspace script.Parent=n CreatorTag.Parent=script Rocket:Destroy()end end
-- Returns the ancestor that contains a Humanoid, if it exists
local function FindCharacterAncestor(subject)
	if subject and subject ~= Workspace then
		local humanoid = subject:FindFirstChild("Humanoid")
		if humanoid then
			return subject, humanoid
		else
			return FindCharacterAncestor(subject.Parent)
		end
	end
	return nil
end

local function OnExplosionHit(hitPart)
	if hitPart then
		local _, humanoid = FindCharacterAncestor(hitPart.Parent)
		if humanoid and humanoid.Health > 0 then
			CreatorTag:Clone().Parent = humanoid
			humanoid:TakeDamage(100)
		end
	end
end

local function OnTouched(otherPart)
	if Rocket and otherPart then
		-- Fly through anything in the ignore list
		if IGNORE_LIST[string.lower(otherPart.Name)] then
			return
		end

		-- Fly through the creator
		local myPlayer = CreatorTag.Value
		if myPlayer and myPlayer.Character and myPlayer.Character:IsAncestorOf(otherPart) then
			return
		end

		OnExplosionHit(hitPart)

		-- Boom
		local explosion = Instance.new("Explosion")
		explosion.BlastPressure = BLAST_PRESSURE
		explosion.BlastRadius = BLAST_RADIUS
		explosion.Position = Rocket.Position
		explosion.Hit:connect(OnExplosionHit)
		explosion.Parent = Workspace

		-- Move this script and the creator tag (so our custom logic can execute), then destroy the rocket
		script.Parent = explosion
		CreatorTag.Parent = script
		Rocket:Destroy()
	end
end
